Edytuj

Udostępnij za pośrednictwem


ObjectExtensions.DangerousGetObjectDataReferenceAt<T> Method

Definition

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

obj
Object

The input Object hosting the target field.

offset
IntPtr

nativeint

The input byte offset for the T reference to retrieve.

Returns

T

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.

Applies to