Advertisement
NikolaDimitroff

What not to do

Jul 25th, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.40 KB | None | 0 0
  1. static void Main(string[] args)
  2.         {
  3.             unsafe
  4.             {
  5.                 ExampleStruct example = new ExampleStruct() { X = 'A', Y = 123321, Z = 0xDEADBEEF };
  6.                 byte* pointer = (byte*)(void*)&example;
  7.                 for (int i = 0; i < sizeof(ExampleStruct); i++)
  8.                 {
  9.                     Console.WriteLine(pointer[i]);
  10.                 }
  11.             }
  12.  
  13.  
  14.         }
  15.  
  16.         struct ExampleStruct
  17.         {
  18.             public char X;
  19.             public int Y;
  20.             public long Z
  21.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement