Unsafe.ByteOffset<T>(T, 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.
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
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.