ObjectExtensions.DangerousGetObjectDataReferenceAt<T> 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.
Gets a T
reference to data within a given Object at a specified offset.
public static ref T DangerousGetObjectDataReferenceAt<T> (this object obj, IntPtr offset);
static member DangerousGetObjectDataReferenceAt : obj * nativeint -> 'T
<Extension()>
Public Function DangerousGetObjectDataReferenceAt(Of T) (obj As Object, offset As IntPtr) As T
Type Parameters
- T
The type of reference to retrieve.
Parameters
- offset
-
IntPtr
nativeint
The input byte offset for the T
reference to retrieve.
Returns
A T
reference at a specified offset within obj
.
Remarks
None of the input arguments is validated, and it is responsability of the caller to ensure they are valid. In particular, using an invalid offset might cause the retrieved reference to be misaligned with the desired data, which would break the type system. Or, if the offset causes the retrieved reference to point to a memory location outside of the input Object instance, that might lead to runtime crashes.