Skip to content

Instantly share code, notes, and snippets.

@rolfbjarne
Created Jan 9, 2014
Embed
What would you like to do?
using System;
using System.Globalization;
using System.Runtime.InteropServices;
class T {
static void Main ()
{
TestUnsafeNFloat ();
}
unsafe static void TestUnsafeNFloat ()
{
int* arr = null;
Console.WriteLine (arr [(nint) 0]);
}
}
namespace System
{
public struct nint
{
public nint (nint v) { this.v = v.v; }
public nint (Int32 v) { this.v = v; }
Int32 v;
public nint (Int64 v) { this.v = (Int32)v; }
public static implicit operator nint (Int32 v) { return new nint (v); }
public static implicit operator Int32 (nint v) { return v.v; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment