CastArrayTFrom, TToGetElementReference 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 TTo GetElementReference(
	int index
)

Parameters

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

Return Value

TTo
The reference to the element at the specified index.

Remarks

This method validates index against Length. To allow getting any reference from the actual underlying array use the GetElementReferenceUnsafe 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