Unsafe.SubtractByteOffset 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| SubtractByteOffset<T>(T, IntPtr) |
從給定的管理指標減去一個位元組偏移量。 |
| SubtractByteOffset<T>(T, UIntPtr) |
從給定的管理指標減去一個位元組偏移量。 |
SubtractByteOffset<T>(T, IntPtr)
- 來源:
- Unsafe.cs
- 來源:
- Unsafe.cs
- 來源:
- Unsafe.cs
- 來源:
- Unsafe.cs
- 來源:
- Unsafe.cs
從給定的管理指標減去一個位元組偏移量。
public:
generic <typename T>
static T % SubtractByteOffset(T % source, IntPtr byteOffset);
public static ref T SubtractByteOffset<T>(ref T source, IntPtr byteOffset) where T : allows ref struct;
public static ref T SubtractByteOffset<T>(ref T source, IntPtr byteOffset);
static member SubtractByteOffset : 'T * nativeint -> 'T
Public Shared Function SubtractByteOffset(Of T) (ByRef source As T, byteOffset As IntPtr) As T
類型參數
- T
管理指標的元素型態。
參數
- source
- T
管理指標用來減去偏移量。
- byteOffset
-
IntPtr
nativeint
用來減去的偏移。
傳回
一個新的管理指標,反映從來源指標中扣除指定位元組偏移量的差異。
備註
參數 byteOffset 是要從指標移除 source 的位元組數。 例如,給定一個類型ref int為 的來源指標 ptr,呼叫Unsafe.SubtractByteOffset<int>(ref ptr, 20)會回傳一個新的指標,其位址指向 ptr 前 20 位元組。
如果 byteOffset 是計算值而非硬編碼的字面值,呼叫者應考慮整數溢位的可能性。 例如,在呼叫 Unsafe.SubtractByteOffset<int>(ref ptr, a * b)中,呼叫者必須確保中間值 a * b 不會超出 的 IntPtr範圍。
適用於
SubtractByteOffset<T>(T, UIntPtr)
- 來源:
- Unsafe.cs
- 來源:
- Unsafe.cs
- 來源:
- Unsafe.cs
- 來源:
- Unsafe.cs
- 來源:
- Unsafe.cs
重要
此 API 不符合 CLS 規範。
從給定的管理指標減去一個位元組偏移量。
public:
generic <typename T>
static T % SubtractByteOffset(T % source, UIntPtr byteOffset);
[System.CLSCompliant(false)]
public static ref T SubtractByteOffset<T>(ref T source, UIntPtr byteOffset) where T : allows ref struct;
public static ref T SubtractByteOffset<T>(ref T source, nuint byteOffset);
[System.CLSCompliant(false)]
public static ref T SubtractByteOffset<T>(ref T source, UIntPtr byteOffset);
[<System.CLSCompliant(false)>]
static member SubtractByteOffset : 'T * unativeint -> 'T
static member SubtractByteOffset : 'T * unativeint -> 'T
Public Shared Function SubtractByteOffset(Of T) (ByRef source As T, byteOffset As UIntPtr) As T
類型參數
- T
管理指標的元素型態。
參數
- source
- T
管理指標用來減去偏移量。
- byteOffset
-
UIntPtr
nuint
unativeint
用來減去的偏移。
傳回
一個新的管理指標,反映從來源指標中扣除指定位元組偏移量的差異。
- 屬性
備註
參數 byteOffset 是從指標中減去的 source 位元組數。 例如,給定一個類型ref int為 的來源指標 ptr,呼叫Unsafe.SubtractByteOffset<int>(ref ptr, (nuint)20)會回傳一個新的指標,其位址指向 ptr 前 20 位元組。
如果 byteOffset 是計算值而非硬編碼的字面值,呼叫者應考慮整數溢位的可能性。 例如,在呼叫 Unsafe.SubtractByteOffset<int>(ref ptr, a * b)中,呼叫者必須確保中間值 a * b 不會超出 的 UIntPtr範圍。