# UIntPtr.Subtract(UIntPtr, Int32)UIntPtr.Subtract(UIntPtr, Int32)UIntPtr.Subtract(UIntPtr, Int32)UIntPtr.Subtract(UIntPtr, Int32) Method

## 定義

``````public:
static UIntPtr Subtract(UIntPtr pointer, int offset);``````
``public static UIntPtr Subtract (UIntPtr pointer, int offset);``
``static member Subtract : unativeint * int -> unativeint``
``Public Shared Function Subtract (pointer As UIntPtr, offset As Integer) As UIntPtr``

#### パラメーター

pointer
UIntPtr UIntPtr UIntPtr UIntPtr

オフセットを減算する符号なしポインター。The unsigned pointer to subtract the offset from.

offset
Int32 Int32 Int32 Int32

#### 戻り値

`offset` からの `pointer` の減算が反映された新しい符号なしポインター。A new unsigned pointer that reflects the subtraction of `offset` from `pointer`.

## 例

``````using System;

public class Example
{
public static void Main()
{
int[] arr = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
UIntPtr ptr = (UIntPtr) arr[arr.GetUpperBound(0)];
for (int ctr = 0; ctr <= arr.GetUpperBound(0); ctr++)
{
UIntPtr newPtr = UIntPtr.Subtract(ptr, ctr);
Console.Write("{0}   ", newPtr);
}
}
}
// The example displays the following output:
//       10   9   8   7   6   5   4   3   2   1
``````
``````Module Example
Public Sub Main()
Dim arr() As Integer = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
Dim ptr As UIntPtr = CType(arr(arr.GetUpperBound(0)), UIntPtr)
For ctr As Integer= 0 To arr.GetUpperBound(0)
Dim newPtr As UIntPtr = UIntPtr.Subtract(ptr, ctr)
Console.Write("{0}   ", newPtr)
Next
End Sub
End Module
' The example displays the following output:
'       10   9   8   7   6   5   4   3   2   1
``````

## 注釈

Subtractを指定したプラットフォームのポインターとして表すには、結果が小さすぎる場合、メソッドが例外をスローできません。The Subtract method does not throw an exception if the result is too small to represent as a pointer on the specified platform. 代わりに、減算操作は、unchecked コンテキストで実行されます。Instead, the subtraction operation is performed in an unchecked context.