ArrayExtensions.DangerousGetReferenceAt Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
DangerousGetReferenceAt<T>(T[], Int32) |
Returns a reference to an element at a specified index within a given |
DangerousGetReferenceAt<T>(T[,], Int32, Int32) |
Returns a reference to an element at a specified coordinate within a given 2D |
DangerousGetReferenceAt<T>(T[], Int32)
Returns a reference to an element at a specified index within a given T
array, with no bounds checks.
public static ref T DangerousGetReferenceAt<T> (this T[] array, int i);
static member DangerousGetReferenceAt : 'T[] * int -> 'T
<Extension()>
Public Function DangerousGetReferenceAt(Of T) (array As T(), i As Integer) As T
Type Parameters
- T
The type of elements in the input T
array instance.
Parameters
- array
- T[]
The input T
array instance.
- i
- Int32
The index of the element to retrieve within array
.
Returns
A reference to the element within array
at the index specified by i
.
Remarks
This method doesn't do any bounds checks, therefore it is responsibility of the caller to ensure the i
parameter is valid.
Applies to
DangerousGetReferenceAt<T>(T[,], Int32, Int32)
Returns a reference to an element at a specified coordinate within a given 2D T
array, with no bounds checks.
public static ref T DangerousGetReferenceAt<T> (this T[,] array, int i, int j);
static member DangerousGetReferenceAt : 'T[,] * int * int -> 'T
<Extension()>
Public Function DangerousGetReferenceAt(Of T) (array As T(,), i As Integer, j As Integer) As T
Type Parameters
- T
The type of elements in the input 2D T
array instance.
Parameters
- array
- T[,]
The input 2D T
array instance.
- i
- Int32
The vertical index of the element to retrieve within array
.
- j
- Int32
The horizontal index of the element to retrieve within array
.
Returns
A reference to the element within array
at the coordinate specified by i
and j
.
Remarks
This method doesn't do any bounds checks, therefore it is responsibility of the caller to ensure the i
and j
parameters are valid. Furthermore, this extension will ignore the lower bounds for the input array, and will just assume that the input index is 0-based. It is responsability of the caller to adjust the input indices to account for the actual lower bounds, if the input array has either axis not starting at 0.