Using structs in C# to read data
<p>Say I have a struct defined as such</p>

<pre><code>struct Student
{
  int age;
  int height;
  char[] name[12];
}
</code></pre>

<p>When I'm reading a binary file, it looks something like</p>

<pre><code>List&lt;Student&gt; students = new List&lt;Student&gt;();
Student someStudent;

int num_students = myFile.readUInt32();
for (int i = 0; i &lt; num_students; i++)
{
   // read a student struct
}
</code></pre>

<p>How can I write my struct so that I just need to say something along the lines of</p>

<pre><code>someStudent = new Student();
</code></pre>

<p>So that it will read the file in the order that the struct is defined, and allow me to get the values as needed with syntax like</p>

<pre><code>someStudent.age;
</code></pre>

<p>I could define the Student as a class and have the constructor read data and populate them, but it wouldn't have any methods beyond getters/setters so I thought a struct would be more appropriate.</p>

<p>Or does it not matter whether I use a class or struct? I've seen others write C code using structs to read in blocks of data and figured it was a "good" way to do it.</p>
