title: Populating a object array with user input. C#
body: <p>Im trying to complete these 2 objectives using C#. I missed the class explaining how to populate an array with an object so i dont really have a starting point how to do the second objective.</p>
  
  <p>"1. Create a Student class with two fields, StudentName (string) and StudentNumber (int), the appropriate properties (i.e. get and set) and constructors (default and non-default). The student name will default to an empty string while the student number will default to -1.</p>
  
  <ol>
  <li>Use the Student class to solve the following problem.
  Create a program that will allow a user to input up to 24 students into an array ensuring that the student number is exactly 5 digits long. Once all the students have been entered, allow the user to do sequential searches for students by either name or number. Display the full student name and number if found, or an error message if not. Allow the user to keep searching until they decide to quit."</li>
  </ol>
  
  <p>The first part i got working and here is my Student Class:</p>
  
  <pre><code>class Student
  {
      // fields
      private string _studentName;
      private int _studentNumber;
  
      // properties
      public string studentName
      {
          get
          {
              return _studentName;
          }
          set
          {
              studentName = value;
          }
      }
      public int studentNumber
      {
          get
          {
              return _studentNumber;
          }
          set
          {
              studentNumber = value;
          }
      }
      // constructors
          // default - no parameters
      public Student()
      {
          _studentName = "";
          _studentNumber = -1;
      }
          // non default - takes perameters
      public Student(string studentName, int studentNumber)
      {
          _studentName = studentName;
          _studentNumber = studentNumber;
      }
  }
  </code></pre>
  
  <p>And here is my main program:</p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          ////////////// Question 1 ////////////////
  
          // create new student
          Student defaultStudent = new Student();
          // display student
          InputOutput.DisplayStudentInformation(defaultStudent);
          // keep console open
          Console.ReadLine();
      }
  }
  </code></pre>
  
  <p>Now im running into the problem with the second part of the objective. I don't know how to use the Object(student) class to help me create a user entered array as i missed that particular lecture.</p>
  
  <p>Im not asking for someone to do the whole assignment for me, i just don't know how to populate the array with a studentName and studentNumber with user input.</p>
  
  <p>I am at my wits end trying to get a starting point here. Anyone?</p>