[]
        
(Showing Draft Content)

GrapeCity.Documents.Pdf.Spec.IPdfArrayExt.TryGet

TryGet Method

TryGet<T>(IPdfArray, int, out T, out bool, bool)

Tries to get the value at the specified index. Returns true if value exists and can be converted to a T, resolves a PDF reference if needed. Note! The method does not resolve reference if T is IPdfRef, otherwise the method resolves the reference and returns actual object.

Declaration
public static bool TryGet<T>(this IPdfArray array, int index, out T value, out bool isNull, bool addWarning) where T : IPdfObject
Public Shared Function TryGet(Of T As IPdfObject)(array As IPdfArray, index As Integer, ByRef value As T, ByRef isNull As Boolean, addWarning As Boolean) As Boolean
Parameters
Type Name Description
IPdfArray array

The current array.

int index

The index of the value to get.

T value

OUT: The value.

bool isNull

OUT: Indicates whether the value is PDF null.

bool addWarning

Indicates whether to add a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if errors occur.

Returns
Type Description
bool

Returns true if no errors occur.

Type Parameters
Name Description
T

TryGet<T>(IPdfArray, int, out T, bool)

Tries to get the value at the specified index. Note! This method returns IPdfRef if T is IPdfRef, otherwise the method resolves the reference and returns actual object.

Declaration
public static bool TryGet<T>(this IPdfArray array, int index, out T value, bool addWarning = true) where T : IPdfObject
Public Shared Function TryGet(Of T As IPdfObject)(array As IPdfArray, index As Integer, ByRef value As T, Optional addWarning As Boolean = True) As Boolean
Parameters
Type Name Description
IPdfArray array

The current array.

int index

The index of the value to get.

T value

OUT: The value at specified index.

bool addWarning

Indicates whether to add a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if value at the specified index can't be converted to the T.

Returns
Type Description
bool

true if successful; false otherwise.

Type Parameters
Name Description
T