@Zaki: you need to mark your build to allow unsafe code and block your unsafe code as follows:
public static class Program {
[STAThread()]
public static void Main(params String[] args) {
Int32 x = 2;
unsafe {
Int32* ptr = &x;
Console.WriteLine("pointer: {0}", *ptr);
*ptr = 400;
Console.WriteLine("pointer (new value): {0}", *ptr);
}
Console.WriteLine("non-pointer: " + x);
Console.ReadKey(true);
}
}
Honestly, I never used pointers to C # (never used).
I did a quick google search and found this , which helped me create the above example.
source
share