CastArrayTFrom, TToGetElementReference Method
Gets the reference to the element at the specified index.
Namespace: KGySoft.CollectionsAssembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.5.0
public ref TTo GetElementReference(
int index
)
Public Function GetElementReference (
index As Integer
) As TTo
public:
TTo% GetElementReference(
int index
)
member GetElementReference :
index : int -> 'TTo
- index Int32
- The index of the element to get the reference for.
TToThe reference to the element at the specified index.
This method validates index against Length. To allow getting any reference from the actual underlying array
use the GetElementReferenceUnsafe method instead.
If
TTo is a primitive type of size larger than 1 byte, and the executing architecture does not support misaligned memory access,
a
DataMisalignedException can be thrown in the moment of dereferencing the result if it its address is not properly aligned.
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.