title: How do I load a byte[] array into a structure in C#?
body: <p>Consider following structure where the length of both <code>username</code> and <code>password</code> is 17:</p>
  
  <pre><code>struct LoginPacket
  {
      public int unk1;
      public string username;
      public string password;
  }
  </code></pre>
  
  <p>Also this byte array</p>
  
  <pre><code>00 00 00 00 6A 6D 32 6D 65 00 72 00 7A 76 72 00 98 FD 18 00 A0 68 65 72 65 49 73
  70 61 73 73 00 00 00 00 00 FF FF 31 2E 30 30 2E 30 30 00 00 00 C7 9D 72 00 04 00
  00 31 2E 31 30 2E 32 37 00 0C 2C F6 24 16 2C F6 24 16
  </code></pre>
  
  <p>Is it possible to load this byte array into the above structure? There is something called <code>Marshal</code>, but it doesn't quite work for me.</p>