loading binary data into a structure
<p>I'm trying to fill a structure (does not have to be an actual struct), with data loaded from a byte[].</p>

<p>There are many different data structures in the byte[], one of them is a string, which is declared as:</p>

<pre><code>UInt16 stringLenght
byte[stringLenght] zeroTerminatedString
</code></pre>

<p>I 'c' language this could be handled by declaring a fixed size struct, and instead of a the struct containing the actual string, make a pointer to the string.</p>

<p>Something like:</p>

<pre><code>UInt16 stringLength
char* zeroTerminatedString
</code></pre>

<p>Is there a (smart) way to do something similar in c#? I mean loading binary data from a file/memory and filling it into a structure?</p>

<p>Regards
Jakob Justesen</p>
