PdfArray Class
An array: an ordered sequence of objects (ISO 32000-2, 7.3.6). It is mutable and not thread-safe.
public sealed class PdfArray : PdfObject, ICollection<PdfObject>, IEnumerable<PdfObject>, IList<PdfObject>, IReadOnlyCollection<PdfObject>, IReadOnlyList<PdfObject>, IEnumerable- Inheritance
PdfObjectPdfArray- Implements
Constructors
| Name | Description |
|---|---|
| PdfArray() | Initializes a new instance of the PdfArray class. |
| PdfArray(IEnumerable<PdfObject>) | Initializes a new instance of the PdfArray class with items. |
PdfArray overloads
PdfArray()
PdfArray.csInitializes a new instance of the PdfArray class.
public PdfArray()PdfArray(IEnumerable<PdfObject>)
PdfArray.csInitializes a new instance of the PdfArray class with items.
public PdfArray(params IEnumerable<PdfObject> items)Parameters
itemsIEnumerable<PdfObject>- The items.
Properties
| Name | Description |
|---|---|
| Count | Gets the number of elements contained in the ICollection<T>. |
| Kind | Gets the kind of the object. |
| System.Collections.Generic.ICollection<Meziantou.Framework.Pdf.Objects.PdfObject>.IsReadOnly |
Count
PdfArray.csKind
PdfArray.csSystem.Collections.Generic.ICollection<Meziantou.Framework.Pdf.Objects.PdfObject>.IsReadOnly
PdfArray.csIndexers
| Name | Description |
|---|---|
| this[int] | Gets or sets the item at an index. The item is not resolved: it may be a PdfReference. |
this[int]
PdfArray.csGets or sets the item at an index. The item is not resolved: it may be a PdfReference.
Methods
| Name | Description |
|---|---|
| Add(PdfObject) | Adds an item. |
| Clear() | Removes all items from the ICollection<T>. |
| Contains(PdfObject) | Determines whether the ICollection<T> contains a specific value. |
| CopyTo(PdfObject[], int) | Copies the elements of the ICollection<T> to an Array, starting at a particular Array index. |
| FromNumbers(ReadOnlySpan<double>) | Creates an array of numbers. |
| GetEnumerator() | Returns an enumerator over the items, which are not resolved. |
| GetNumber(int, double) | Gets the item at an index as a number. |
| GetResolved(int) | Gets the item at an index, resolving it when it is a reference. |
| IndexOf(PdfObject) | Determines the index of a specific item in the IList<T>. |
| Insert(int, PdfObject) | Inserts an item. |
| Remove(PdfObject) | Removes the first occurrence of a specific object from the ICollection<T>. |
| RemoveAt(int) | Removes the IList<T> item at the specified index. |
| System.Collections.Generic.IEnumerable<Meziantou.Framework.Pdf.Objects.PdfObject>.GetEnumerator() | |
| System.Collections.IEnumerable.GetEnumerator() | |
| TryGetResolved<T>(int, T?) | Gets the item at an index, resolved, when it has a type. |
Add(PdfObject)
PdfArray.csClear()
PdfArray.csRemoves all items from the ICollection<T>.
public void Clear()Exceptions
NotSupportedException- The
ICollection<T>is read-only.
Contains(PdfObject)
PdfArray.csDetermines whether the ICollection<T> contains a specific value.
Parameters
itemPdfObject- The object to locate in the
ICollection<T>.
Returns
bool true if item is found in the ICollection<T>; otherwise, false.
CopyTo(PdfObject[], int)
PdfArray.csCopies the elements of the ICollection<T> to an Array, starting at a particular Array index.
Parameters
arrayPdfObject[]- The one-dimensional
Arraythat is the destination of the elements copied fromICollection<T>. TheArraymust have zero-based indexing. arrayIndexint- The zero-based index in
arrayat which copying begins.
Exceptions
ArgumentNullExceptionarrayisnull.ArgumentOutOfRangeExceptionarrayIndexis less than 0.ArgumentException- The number of elements in the source
ICollection<T>is greater than the available space fromarrayIndexto the end of the destinationarray.
FromNumbers(ReadOnlySpan<double>)
PdfArray.csCreates an array of numbers.
public static PdfArray FromNumbers(params scoped ReadOnlySpan<double> values)Parameters
valuesReadOnlySpan<double>- The numbers.
Returns
PdfArray The array: integers for the values that are whole numbers, real numbers for the others.
GetEnumerator()
PdfArray.csReturns an enumerator over the items, which are not resolved.
public List<PdfObject>.Enumerator GetEnumerator()Returns
List<PdfObject>.Enumerator The enumerator.
GetNumber(int, double)
PdfArray.csGetResolved(int)
PdfArray.csGets the item at an index, resolving it when it is a reference.
Parameters
indexint- The index.
Returns
PdfObject The item, or PdfNull.Instance for a reference to an object that does not exist.
IndexOf(PdfObject)
PdfArray.csInsert(int, PdfObject)
PdfArray.csRemove(PdfObject)
PdfArray.csRemoves the first occurrence of a specific object from the ICollection<T>.
Parameters
itemPdfObject- The object to remove from the
ICollection<T>.
Returns
bool true if item was successfully removed from the ICollection<T>; otherwise, false. This method also returns false if item is not found in the original ICollection<T>.
Exceptions
NotSupportedException- The
ICollection<T>is read-only.
RemoveAt(int)
PdfArray.csRemoves the IList<T> item at the specified index.
Parameters
indexint- The zero-based index of the item to remove.
Exceptions
ArgumentOutOfRangeExceptionindexis not a valid index in theIList<T>.NotSupportedException- The
IList<T>is read-only.