private unsafe void PrintDemo(Demo *pDemo) { /* * The first way to access the properties of the struct is to use the "*" followed by the stuct pointer * contained in brackets. Then you simply use dot notation like you would a normal struct. As seen below. */ Console.WriteLine((*pDemo).N + " " + (*pDemo).M); /* * The second way to access the value is to use the arrow function. As seen below */ Console.WriteLine(pDemo->N + " " + pDemo->M); }
//pointers with struct static unsafe void PrintDemo(Demo *demo) { Console.WriteLine((*demo).N + " " + (*demo).M); Console.WriteLine(demo->N + " " + demo->M); }