Table of Contents

Class ArrayOrSingleItemHelper

Namespace
PdfSharp.Pdf
Assembly
PdfSharp.dll

Provides methods to handle keys that may contain a PdfArray or a single PdfItem.

public class ArrayOrSingleItemHelper
Inheritance
ArrayOrSingleItemHelper
Inherited Members

Constructors

ArrayOrSingleItemHelper(DictionaryElements)

Initializes ArrayOrSingleItemHelper with PdfDictionary.DictionaryElements to work with.

public ArrayOrSingleItemHelper(PdfDictionary.DictionaryElements elements)

Parameters

elements PdfDictionary.DictionaryElements

Methods

Add(string, PdfItem, bool)

Adds a PdfItem to the given key. Creates a PdfArray containing the items, if needed.

public void Add(string key, PdfItem value, bool prepend = false)

Parameters

key string

The key in the dictionary to work with.

value PdfItem

The PdfItem to add.

prepend bool

True, if value shall be prepended instead of appended.

Contains<T>(string, Func<T, bool>)

Returns true if the given key contains a PdfItem of type T matching a predicate.

public bool Contains<T>(string key, Func<T, bool> predicate) where T : PdfItem

Parameters

key string

The key in the dictionary to work with.

predicate Func<T, bool>

The predicate, that shall be true for the desired item(s).

Returns

bool

Type Parameters

T

Contains<T>(string, object)

Returns true if the given key contains a PdfItem of type T, that is equal to value.

public bool Contains<T>(string key, object value) where T : PdfItem

Parameters

key string

The key in the dictionary to work with.

value object

The value, the desired item(s) shall be equal to.

Returns

bool

Type Parameters

T

Contains<T>(string, T)

Returns true if the given key contains a PdfItem of type T, that is equal to value.

public bool Contains<T>(string key, T value) where T : PdfItem

Parameters

key string

The key in the dictionary to work with.

value T

The value, the desired item(s) shall be equal to.

Returns

bool

Type Parameters

T

GetAll(string)

Gets all PdfItems saved in the given key.

public IEnumerable<PdfItem> GetAll(string key)

Parameters

key string

The key in the dictionary to work with.

Returns

IEnumerable<PdfItem>

Get<T>(string, Func<T, bool>)

Gets the PdfItem(s) of type T saved in the given key, that match a predicate.

public IEnumerable<T> Get<T>(string key, Func<T, bool> predicate) where T : PdfItem

Parameters

key string

The key in the dictionary to work with.

predicate Func<T, bool>

The predicate, that shall be true for the desired item(s).

Returns

IEnumerable<T>

Type Parameters

T

Get<T>(string, object)

Gets the PdfItem(s) of type T saved in the given key, that are equal to value.

public IEnumerable<T> Get<T>(string key, object value) where T : PdfItem

Parameters

key string

The key in the dictionary to work with.

value object

The value, the desired item(s) shall be equal to.

Returns

IEnumerable<T>

Type Parameters

T

Get<T>(string, T)

Gets the PdfItem(s) of type T saved in the given key, that are equal to value.

public IEnumerable<T> Get<T>(string key, T value) where T : PdfItem

Parameters

key string

The key in the dictionary to work with.

value T

The value, the desired item(s) shall be equal to.

Returns

IEnumerable<T>

Type Parameters

T

Remove<T>(string, Func<T, bool>)

Removes the PdfItem(s) of type T saved in the given key, that match a predicate. Removes the PdfArray, if no longer needed. Returns true if items were removed.

public bool Remove<T>(string key, Func<T, bool> predicate) where T : PdfItem

Parameters

key string

The key in the dictionary to work with.

predicate Func<T, bool>

The predicate, that shall be true for the desired item(s).

Returns

bool

Type Parameters

T

Remove<T>(string, object)

Removes the PdfItem(s) of type T saved in the given key, that are equal to value. Removes the PdfArray, if no longer needed. Returns true if items were removed.

public bool Remove<T>(string key, object value) where T : PdfItem

Parameters

key string

The key in the dictionary to work with.

value object

The value, the desired item(s) shall be equal to.

Returns

bool

Type Parameters

T

Remove<T>(string, T)

Removes the PdfItem(s) of type T saved in the given key, that are equal to value. Removes the PdfArray, if no longer needed. Returns true if items were removed.

public bool Remove<T>(string key, T value) where T : PdfItem

Parameters

key string

The key in the dictionary to work with.

value T

The value, the desired item(s) shall be equal to.

Returns

bool

Type Parameters

T