ArraySectionTGetElementReference Method

Gets the reference to the element at the specified index.

Definition

Namespace: KGySoft.Collections
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.0.0
C#
public ref T GetElementReference(
	int index
)

Parameters

index  Int32
The index of the element to get the reference for.

Return Value

T
The reference to the element at the specified index.

Remarks

This method validates index against Length. To allow returning a reference to any element from the UnderlyingArray (allowing even a negative index if Offset is nonzero), then use the GetElementReferenceUnchecked method instead.

  Note

This method returns a value by reference. If this library is used by an older compiler that does not support such members, use the indexer instead.

Exceptions

IndexOutOfRangeExceptionindex is less than zero or greater or equal to Length.
VerificationException.NET Framework only: you execute this method in a partially trusted AppDomain that does not allow executing unverifiable code.

See Also