title: Array of structs in C#
body: <p>I'm trying to get input from user using array of structs and then print it:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  namespace CA4
  {
  class Program
  {
      static void Main(string[] args)
      {
          StudentDetails[,] student = new StudentDetails[5, 1];
  
          Console.WriteLine("Please enter the unit code:");
          student[0, 0].unitCode = Console.ReadLine();
  
          Console.WriteLine("Please enter the unit number:");
          student[1, 0].unitNumber = Console.ReadLine();
  
          Console.WriteLine("Please enter first name:");
          student[2, 0].firstName = Console.ReadLine();
  
          Console.WriteLine("Please enter last name:");
          student[3, 0].lastName = Console.ReadLine();
  
          Console.WriteLine("Please enter student mark:");
          student[4, 0].studentMark = int.Parse(Console.ReadLine());
  
          for (int row = 0; row &lt; 5; row++)
          {
              Console.WriteLine();
              for (int column = 0; column &lt; 1; column++)
                  Console.WriteLine("{0} ", student[row, column]);
          }
  
          Console.ReadLine();
      }
  
      public struct StudentDetails
      {
          public string unitCode; //eg CSC10208
          public string unitNumber; //unique identifier
          public string firstName; //first name
          public string lastName;// last or family name
          public int studentMark; //student mark
      }
  
  }
  }
  </code></pre>
  
  <p>Unfortunately after entering all the data I get:</p>
  
  <pre><code>CA4.Program+StudentDetails
  
  CA4.Program+StudentDetails
  
  CA4.Program+StudentDetails
  
  CA4.Program+StudentDetails
  
  CA4.Program+StudentDetails
  </code></pre>
  
  <p>It doesn't crash, just instead of the data that I entered get the above 5 lines.</p>
  
  <p>I know that the reason why it doesn't work is that I don't use the structs correctly because without them there is no problem.</p>
  
  <p>Can somebody please help me and tell me how to use structs propely in the example above. Thanks</p>
  
  <p>Cheers,</p>
  
  <p>n1te</p>