PdfTree<TKey, TValue> Class
Represents a base class for name trees and number trees.
public abstract class PdfTree<TKey, TValue> : PdfCollection<KeyValuePair<TKey, TValue>>, IList, ICollection, IList<KeyValuePair<TKey, TValue>>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable
Public MustInherit Class PdfTree(Of TKey As PdfBasicValue, TValue)
Inherits PdfCollection(Of KeyValuePair(Of TKey, TValue))
Implements IList, ICollection, IList(Of KeyValuePair(Of TKey, TValue)), ICollection(Of KeyValuePair(Of TKey, TValue)), IEnumerable(Of KeyValuePair(Of TKey, TValue)), IEnumerable
Type Parameters
TKey
The type of the keys in the tree. PdfString for name trees and PdfInteger for number trees.
TValue
The type of the values in the tree.
- Inheritance:
- System.ObjectPdfCollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>PdfTree<TKey, TValue>
- Derived
Implements
Remarks
PdfString and PdfInteger are used as keys instead of System.String and System.Int32 to avoid, possibly costly, conversions.
GemBox.Pdf, currently, doesn't maintain the tree's structure when modifying the tree. Instead the entire tree structure is flattened into a single root node.
Properties
Item[TKey]
Gets or sets the value associated with the specified key.
Parameters
key
- TKey
The key of the value to get or set.
Property Value
- TValue
The value associated with the specified key. If the specified key is not found, a get operation returns default value. A set operation overrides existing or adds a new entry with the specified key and value.
Exceptions
- System.ArgumentNullException
key
is null.
Methods
Add(TKey, TValue)
Adds the specified key and value to the tree.
Parameters
key
- TKey
The key of the entry to add.
value
- TValue
The value of the entry to add.
Exceptions
- System.ArgumentNullException
key
is null.
- System.ArgumentException
An entry with the same key already exists in the tree.
ContainsKey(TKey)
Determines whether the tree contains the specified key.
Parameters
key
- TKey
The key to locate in the tree.
Returns
- System.Boolean
true if the tree contains an entry with the specified key; otherwise, false.
Exceptions
- System.ArgumentNullException
key
is null.
GetEnumerator()
Returns an enumerator that iterates through the PdfTree<TKey, TValue>.
public PdfTree<TKey, TValue>.Enumerator GetEnumerator()
Public Function GetEnumerator As PdfTree(Of TKey, TValue).Enumerator
Returns
Remove(TKey)
Removes the value with the specified key from the tree.
Parameters
key
- TKey
The key of the entry to remove.
Returns
- System.Boolean
true if the key is found and the entry removed; otherwise, false. This method returns false if key is not found in the tree.
Exceptions
- System.ArgumentNullException
key
is null.
TryGetValue(TKey, out TValue)
Gets the value associated with the specified key.
public bool TryGetValue(TKey key, out TValue value)
Public Function TryGetValue(key As TKey, ByRef value As TValue) As Boolean
Parameters
key
- TKey
The key of the value to get.
value
- TValue
When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value
parameter.
Returns
- System.Boolean
true if the tree contains an entry with the specified key; otherwise, false.
Exceptions
- System.ArgumentNullException
key
is null.
Inherited Properties
Count | Gets the number of elements contained in the PdfCollection. (Inherited from PdfCollection) |
Metadata | (Optional; PDF 1.4) A metadata stream containing metadata for the component. (Inherited from PdfObject) |
Inherited Methods
Clear() | Removes all elements from the PdfCollection. (Inherited from PdfCollection) |
RemoveAt(System.Int32) | Removes the element at the specified index of the PdfCollection. (Inherited from PdfCollection) |