PdfCollection<T> Class
Represents a base class for all collection types that implement various PDF components in the GemBox.Pdf assembly.
public abstract class PdfCollection<T> : PdfCollection, IList, ICollection, IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable
Public MustInherit Class PdfCollection(Of T)
Inherits PdfCollection
Implements IList, ICollection, IList(Of T), ICollection(Of T), IEnumerable(Of T), IEnumerable
Type Parameters
T
The type of elements in the collection.
- Inheritance:
- System.ObjectPdfCollection<T>
- Derived
Implements
Properties
Item[Int32]
Gets or sets the element at the specified index.
Parameters
index
- System.Int32
The zero-based index of the element to get or set.
Property Value
- T
The element at the specified index.
Exceptions
- System.InvalidOperationException
The underlying PdfArray is read-only (IsReadOnly returns true).
- System.ArgumentOutOfRangeException
index
is less than 0 or index
is equal to or greater than Count.
- System.ArgumentException
value
is invalid for the current collection.
Methods
Add(T)
Adds an element to the end of the PdfCollection<T>.
Parameters
item
- T
The element to be added to the end of the PdfCollection<T>.
Exceptions
- System.InvalidOperationException
The underlying PdfArray is read-only (IsReadOnly returns true).
- System.ArgumentException
item
is invalid for the current collection.
Contains(T)
Determines whether an element is in the PdfCollection<T>.
Parameters
item
- T
The element to locate in the PdfCollection<T>.
Returns
- System.Boolean
true if item
is found in the PdfCollection<T>; otherwise, false.
CopyTo(T[], Int32)
Copies the entire PdfCollection<T> to a compatible one-dimensional array, starting at the specified index of the target array.
public void CopyTo(T[] array, int arrayIndex)
Public Sub CopyTo(array As T(), arrayIndex As Integer)
Parameters
array
- T[]
The one-dimensional System.Array that is the destination of the elements copied from PdfCollection<T>. The System.Array must have zero-based indexing.
arrayIndex
- System.Int32
The zero-based index in array
at which copying begins.
Exceptions
- System.ArgumentNullException
array
is null.
- System.ArgumentOutOfRangeException
arrayIndex
is less than 0 or greater than array
's System.Array.Length.
- System.ArgumentException
The number of elements in the source PdfCollection<T> is greater than the available space from arrayIndex
to the end of the destination array
.
GetEnumerator()
Returns an enumerator that iterates through the PdfCollection<T>.
public PdfCollection<T>.Enumerator GetEnumerator()
Public Function GetEnumerator As PdfCollection(Of T).Enumerator
Returns
IndexOf(T)
Searches for the specified element and returns the zero-based index of the first occurrence within the entire PdfCollection<T>.
Parameters
item
- T
The element to locate in the PdfCollection<T>.
Returns
- System.Int32
The zero-based index of the first occurrence of item
within the entire PdfCollection<T>, if found; otherwise, –1.
Insert(Int32, T)
Inserts an element into the PdfCollection<T> at the specified index.
Parameters
index
- System.Int32
The zero-based index at which item
should be inserted.
item
- T
The element to insert.
Exceptions
- System.InvalidOperationException
The underlying PdfArray is read-only (IsReadOnly returns true).
- System.ArgumentOutOfRangeException
index
is less than 0 or index
is greater than Count.
- System.ArgumentException
item
is invalid for the current collection.
Remove(T)
Removes the first occurrence of a specific element from the PdfCollection<T>.
Parameters
item
- T
The element to remove from the PdfCollection<T>.
Returns
- System.Boolean
true if item
is successfully removed; otherwise, false. This method also returns false if item
was not found in the PdfCollection<T>.
Exceptions
- System.InvalidOperationException
The underlying PdfArray is read-only (IsReadOnly returns true).
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) |