Skip to content

# PDFCosArray

Namespace: O2S.Components.PDF4NET.Core.Cos

Defines a PDF COS array.

    public class PDFCosArray : PDFCosObject

Inheritance Object → PDFCosObject → PDFCosArray

## Constructors

### PDFCosArray()

Initializes a new PDFCosArray object.

    public PDFCosArray()

### PDFCosArray(Double[])

Initializes a new PDFCosArray object with an array of doubles.

    public PDFCosArray(Double[] items)

Parameters

`items` Double[]
Initial array items

## Properties

### Item

    public PDFCosObject Item { get; set; }

Property Value

PDFCosObject

### Length

Gets the number of elements actually contained in the array.

    public int Length { get; }

Property Value

Int32

### Type

Gets the object type.

    public PDFCosObjectType Type { get; }

Property Value

PDFCosObjectType

## Methods

### Add(PDFCosObject)

Adds an object to the end of the array.

    public void Add(PDFCosObject item)

Parameters

`item` PDFCosObject
The object to be added to the end of the array.

Exceptions

ArgumentNullException
Thrown when the item is null.

### AddRange(PDFCosArray)

Adds the elements of the specified array to the end of this array.

    public void AddRange(PDFCosArray array)

Parameters

`array` PDFCosArray
The array whose elements should be added to the end of this array. The array itself cannot be nulland it cannot contain elements that are null.

Exceptions

ArgumentNullException
Thrown when the array is null or when the array contains null elements.

### Clear()

Removes all elements from the array.

    public void Clear()

### GetElementAsBool(Int32)

Gets the element at the specified index as a boolean.

    public bool GetElementAsBool(int index)

Parameters

`index` Int32
Index of element to return.

Returns

Boolean
A bool representing the element.

Exceptions

ArgumentOutOfRangeException
Thrown when the index value is invalid

### GetElementAsNumber(Int32)

Gets the element at the specified index as a double.

    public double GetElementAsNumber(int index)

Parameters

`index` Int32
Index of element to return.

Returns

Double
A double representing the element.

Exceptions

ArgumentOutOfRangeException
Thrown when the index value is invalid

### GetElementAsString(Int32)

Gets the element at the specified index as a string.

    public string GetElementAsString(int index)

Parameters

`index` Int32
Index of element to return.

Returns

String
A string representing the element.

Exceptions

ArgumentOutOfRangeException
Thrown when the index value is invalid

### IndexOf(PDFCosObject)

Searches for the specified object and returns the zero-based index of the first occurrence within the entire array.

    public int IndexOf(PDFCosObject obj)

Parameters

`obj` PDFCosObject
The object to locate in the array.

Returns

Int32
The zero-based index of the first occurrence of item within the entire array, if found; otherwise, –1.

### Insert(Int32, PDFCosObject)

Inserts an element into the array at the specified index.

    public void Insert(int index, PDFCosObject item)

Parameters

`index` Int32
The zero-based index at which item should be inserted.

`item` PDFCosObject
The object to insert.

Exceptions

ArgumentNullException
Thrown when the item is null.

### Remove(PDFCosObject)

Removes the first occurrence of a specific object from the array.

    public void Remove(PDFCosObject obj)

Parameters

`obj` PDFCosObject
The object to remove from the array.

### RemoveAt(Int32)

Removes the element at the specified index of the array.

    public void RemoveAt(int index)

Parameters

`index` Int32
The zero-based index of the element to remove.

Exceptions

ArgumentOutOfRangeException
Thrown when the index is out of range.

### ToString()

Returns a String that represents the current Object.

    public string ToString()

Returns

String
String that represents the current Object.