PdfArray Class

An array: an ordered sequence of objects (ISO 32000-2, 7.3.6). It is mutable and not thread-safe.

Inheritance
PdfObject PdfArray
Implements

Constructors

NameDescription
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.cs

Initializes a new instance of the PdfArray class.

public PdfArray()

PdfArray(IEnumerable<PdfObject>)

PdfArray.cs

Initializes a new instance of the PdfArray class with items.

public PdfArray(params IEnumerable<PdfObject> items)
Parameters
items IEnumerable<PdfObject>
The items.

Properties

NameDescription
CountGets the number of elements contained in the ICollection<T>.
KindGets the kind of the object.
System.Collections.Generic.ICollection<Meziantou.Framework.Pdf.Objects.PdfObject>.IsReadOnly

Gets the number of elements contained in the ICollection<T>.

public int Count { get; }

Property value

int

Gets the kind of the object.

public override PdfObjectKind Kind { get; }

Property value

PdfObjectKind

System.Collections.Generic.ICollection<Meziantou.Framework.Pdf.Objects.PdfObject>.IsReadOnly

PdfArray.cs
bool ICollection<PdfObject>.IsReadOnly { get; }

Property value

bool

No documentation is available.

Indexers

NameDescription
this[int]Gets or sets the item at an index. The item is not resolved: it may be a PdfReference.

this[int]

PdfArray.cs

Gets or sets the item at an index. The item is not resolved: it may be a PdfReference.

public PdfObject this[int index] { get; set; }

Parameters

index int
The index.

Property value

PdfObject

Methods

NameDescription
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.cs

Adds an item.

public void Add(PdfObject item)

Parameters

item PdfObject
The item.

Removes all items from the ICollection<T>.

public void Clear()

Exceptions

NotSupportedException
The ICollection<T> is read-only.

Contains(PdfObject)

PdfArray.cs

Determines whether the ICollection<T> contains a specific value.

public bool Contains(PdfObject item)

Parameters

item PdfObject
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.cs

Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.

public void CopyTo(PdfObject[] array, int arrayIndex)

Parameters

array PdfObject[]
The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.
arrayIndex int
The zero-based index in array at which copying begins.

Exceptions

ArgumentNullException
array is null.
ArgumentOutOfRangeException
arrayIndex is less than 0.
ArgumentException
The number of elements in the source ICollection<T> is greater than the available space from arrayIndex to the end of the destination array.

FromNumbers(ReadOnlySpan<double>)

PdfArray.cs

Creates an array of numbers.

public static PdfArray FromNumbers(params scoped ReadOnlySpan<double> values)

Parameters

values ReadOnlySpan<double>
The numbers.

Returns

PdfArray The array: integers for the values that are whole numbers, real numbers for the others.

GetEnumerator()

PdfArray.cs

Returns an enumerator over the items, which are not resolved.

public List<PdfObject>.Enumerator GetEnumerator()

Returns

List<PdfObject>.Enumerator The enumerator.

GetNumber(int, double)

PdfArray.cs

Gets the item at an index as a number.

public double GetNumber(int index, double defaultValue = 0d)

Parameters

index int
The index.
defaultValue double
The value when the item is not a number or the index is out of the array.

Returns

double The number.

GetResolved(int)

PdfArray.cs

Gets the item at an index, resolving it when it is a reference.

public PdfObject GetResolved(int index)

Parameters

index int
The index.

Returns

PdfObject The item, or PdfNull.Instance for a reference to an object that does not exist.

IndexOf(PdfObject)

PdfArray.cs

Determines the index of a specific item in the IList<T>.

public int IndexOf(PdfObject item)

Parameters

item PdfObject
The object to locate in the IList<T>.

Returns

int The index of item if found in the list; otherwise, -1.

Insert(int, PdfObject)

PdfArray.cs

Inserts an item.

public void Insert(int index, PdfObject item)

Parameters

index int
The index of the item.
item PdfObject
The item.

Remove(PdfObject)

PdfArray.cs

Removes the first occurrence of a specific object from the ICollection<T>.

public bool Remove(PdfObject item)

Parameters

item PdfObject
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.cs

Removes the IList<T> item at the specified index.

public void RemoveAt(int index)

Parameters

index int
The zero-based index of the item to remove.

Exceptions

ArgumentOutOfRangeException
index is not a valid index in the IList<T>.
NotSupportedException
The IList<T> is read-only.

System.Collections.Generic.IEnumerable<Meziantou.Framework.Pdf.Objects.PdfObject>.GetEnumerator()

PdfArray.cs

No documentation is available.

System.Collections.IEnumerable.GetEnumerator()

PdfArray.cs
IEnumerator IEnumerable.GetEnumerator()

No documentation is available.

TryGetResolved<T>(int, T?)

PdfArray.cs

Gets the item at an index, resolved, when it has a type.

public bool TryGetResolved<T>(int index, out T? value) where T : PdfObject

Type parameters

T
The type of the item.

Parameters

index int
The index.
value T?
The item.

Returns

bool true when the index is in the array and the resolved item has the type.