title: How to convert Struct to a Class
body: <p>So I'm fairly new to C# and I've been tasked with converting my <strong>student_data</strong> struct to  a class, a lot of the information I found when I looked online is to do with C++ which I didn't find useful. The code works as is but I am struggling to modify it to fit my task. It is a console program which prints out all the values in the array.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  namespace Student
  {
      class Program
      {
          public struct student_data
          {
              public string forename;
              public string surname;
              public int id_number;
              public float averageGrade;
              public string ptitle;
              public string pcode;
          }
  
          public struct module_data
          {
              public string mcode;
              public string mtitle;
              public int mark;
          }
  
          static void populateStruct(out student_data student, string fname, string surname, int id_number, string ptitle, string pcode)
          {
              student.forename = fname;
              student.surname = surname;
              student.id_number = id_number;
              student.averageGrade = 0.0F;
              student.ptitle = ptitle;
              student.pcode = pcode;
          }
  
          static void populateModule(out module_data module, string mcode, string mname, int score)
          {
              module.mcode = mcode;
              module.mtitle = mname;
              module.mark = score;
          }
  
          static void Main(string[] args)
          {
              student_data[] students = new student_data[4];
              populateStruct (out students[0], "Mark", "Anderson", 1, "Title1", "Code1");
              populateStruct (out students[1], "John", "Smith", 2, "Title2", "Code2");
              populateStruct (out students[2], "Tom", "Jones", 3, "Title3", "Code3");
              populateStruct (out students[3], "Ewan", "Evans", 4, "Title4", "Code4");
              module_data[] modules = new module_data[4];
              populateModule (out modules [0], "MCode1", "MTitle1", 1);
              populateModule (out modules [1], "MCode2", "MTitle2", 2);
              populateModule (out modules [2], "MCode3", "MTitle3", 3);
              populateModule (out modules [3], "MCode4", "MTitle4", 4);
  
              foreach (student_data value in students) {
                  printStudent(value);
              }
  
              foreach (module_data value in modules) {
                  printModule(value);
              }
  
          }
  
          static void printStudent(student_data student)
          {
              Console.WriteLine("Name: " + student.forename + " " + student.surname);
              Console.WriteLine("Id: " + student.id_number);
              Console.WriteLine("Av grade: " + student.averageGrade);
              Console.WriteLine("Programme Title: " + student.ptitle);
              Console.WriteLine("Programme Code: " + student.pcode);
              Console.WriteLine(" ");
          }
  
          static void printModule(module_data module)
          {
              Console.WriteLine("Module Code: " + module.mcode);
              Console.WriteLine("Module Title: " + module.mtitle);
              Console.WriteLine("Module Mark: " + module.mark);
              Console.WriteLine(" ");
          }
      }
  }
  </code></pre>