Uređivanje

Dijeli putem


Unsafe.ByteOffset<T>(T, T) Method

Definition

Determines the byte offset from origin to target from the given managed pointers.

public:
generic <typename T>
 static IntPtr ByteOffset(T % origin, T % target);
public static IntPtr ByteOffset<T> (ref T origin, ref T target);
static member ByteOffset : 'T * 'T -> nativeint
Public Shared Function ByteOffset(Of T) (ByRef origin As T, ByRef target As T) As IntPtr

Type Parameters

T

The elemental type of the managed pointers.

Parameters

origin
T

The managed pointer to the origin.

target
T

The managed pointer to the target.

Returns

IntPtr

nativeint

The byte offset from origin to target, that is, target - origin.

Remarks

The return value of this method is a moment-in-time result. If origin and target each reference different objects in GC-managed address space, the GC could relocate items between calls, causing the result of this method to change.

The return value is guaranteed stable if origin and target point to the same managed object.

Applies to