using System;
class MyClass {
public int num;
public MyClass(int i) { num = i; }
}
class FixedCode {
unsafe public static void Main() {
MyClass o = new MyClass(19);
fixed (int* p = &o.num) {
Console.WriteLine("Initial value of o.num is " + *p);
*p = 10; // assign the to count via p
Console.WriteLine("New value of o.num is " + *p);
}
}
}
|