title: Reading data from a file into an array of class objects
body: <p>I'm reading data from a file that I need to be put into my array of objects (myEmployees). I believe my code is correct until the end of this example, but I am not sure how to read the data from the file, split it, and then put it correctly into my array of class objects.</p>
  
  <pre><code>//declare an array of employees
  Employee[] myEmployees = new Employee[10];
  
  //declare other variables
  string inputLine;
  string EmpName;
  int EmpNum;
  double EmpWage;
  double EmpHours;
  string EmpAdd;
  
  //declare filepath
  string environment = System.Environment.GetFolderPath
  (System.Environment.SpecialFolder.Personal) + "\\";
  
  //get input
  Console.Write("\nEnter a file name in My Documents: ");
  string input = Console.ReadLine();
  string path = environment + input;
  Console.WriteLine("Opening the file...");
  
  //read file
  StreamReader myFile = new StreamReader(path);
  inputLine = (myFile.ReadLine());
  </code></pre>
  
  <p>So I am reading data from a file that is structured like:</p>
  
  <pre><code>Employee Number
  Employee Name
  Employee Address
  Employee wage Employee Hours
  </code></pre>
  
  <p>I need to read data from this file and parse it into the array of Employees that I've created. Here is the class data for class Employee:</p>
  
  <pre><code>public void Employeeconst ()
  {
      employeeNum = 0;
      name = "";
      address = "";
      wage = 0.0;
      hours = 0.0;
  }
  public void SetEmployeeNum(int a)
  {
      employeeNum = a;
  }
  public void SetName(string a)
  {
      name = a;
  }
  public void SetAddress(string a)
  {
      address = a;
  }
  public void SetWage(double a)
  {
      wage = a;
  }
  public void SetHours(double a)
  {
      hours = a;
  }
  public int GetEmployeeNum()
  {
      return employeeNum;
  }
  public string GetName()
  {
      return name;
  }
  public string GetAddress()
  {
      return address;
  }
  public double GetWage()
  {
      return wage;
  }
  public double GetHours()
  {
      return hours;
  }
  </code></pre>