CastArrayTFrom, TToGetElementReferenceUnsafe Method
Namespace: KGySoft.CollectionsAssembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.5.0
[SecurityCriticalAttribute]
public ref TTo GetElementReferenceUnsafe(
int index
)
<SecurityCriticalAttribute>
Public Function GetElementReferenceUnsafe (
index As Integer
) As TTo
public:
[SecurityCriticalAttribute]
TTo% GetElementReferenceUnsafe(
int index
)
[<SecurityCriticalAttribute>]
member GetElementReferenceUnsafe :
index : int -> 'TTo
- index Int32
- The index of the element to get the reference for.
TToThe reference to the element at the specified index.
You must ensure that
index falls within
Length, or at least in the bounds
of the actual underlying array. Attempting to access protected memory may crash the runtime.
Also, 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 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
GetElementUnsafe/
SetElementUnsafe methods instead.