UIntPtr - Subtract

Subtracts an offset from the value of an unsigned pointer.

Try it

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++)
  	{
		// C# Extension Method: UIntPtr - Subtract
     	UIntPtr newPtr = ptr.Subtract(ctr);
     	Console.Write("{0}   ", newPtr);
  	} 
}

View Source
using System;

public static partial class Extensions
{
    /// <summary>
    ///     Subtracts an offset from the value of an unsigned pointer.
    /// </summary>
    /// <param name="pointer">The unsigned pointer to subtract the offset from.</param>
    /// <param name="offset">The offset to subtract.</param>
    /// <returns>A new unsigned pointer that reflects the subtraction of  from .</returns>
    public static UIntPtr Subtract(this UIntPtr pointer, Int32 offset)
    {
        return UIntPtr.Subtract(pointer, offset);
    }
}