static void Main(string[] args) { var stackalloc2 = default(foo); var stackalloc1 = default(foo); stackalloc1.field32 = 40; foo *alias = &stackalloc1; alias->Increment(ref stackalloc2); stackalloc1.Print(); //TestStructByRefInvoke_foo_Increment((TestStructByRefInvoke_foo)foo0); stackalloc1.Increment(ref stackalloc2); stackalloc1.Print(); foo.PrintCopy(copy: stackalloc2); //fixed (foo* alias = &stackalloc2) //{ //} //field32: 41 //field32: 42 //X:\jsc.svn\examples\c\Test\TestStructByRefInvoke\TestStructByRefInvoke\bin\Release\web>TestStructByRefInvoke.exe //field32: 41 //field32: 41 //field32: 42 }
static void Main() { foo *f = null; }