title: Reading a text file and assigning certain lines to certain variables
body: <p>I'm working on a Trivia C# console game which reads a text file  that has a question , answer multiple choices ,the number of the correct choice and answer explanation.There is four question sets .The task is to prompt each question in the file to the console window ,have the user enter the answer  then compare the user's answer with the correct one.That should be done for all four questions in the file.</p>
  
  <p>A class that includes question ,multipleAnswewrChoice,correctAnswer and answerExplanation has been created with getters and setters for each field .</p>
  
  <p>What I'm struggle with is how after reading the file ,to assign each question to a certain variable in order to prompt it to the user and also to do this for four sets.
  I made an array of size 4 (as I have 4 lines for each question set) to store the lines then assigned each element to each variable above ,but I couldn't figure out how to loop to do the same for all four sets.</p>
  
  <p>The QuestionUnit is the class that contains the question fields.</p>
  
  <pre><code> public void ReadQuestionFile( QuestionUnit unit)
          {
              string[] arrayReader = new string[4];
              string line = "";
              int i = 0;
              string fileName = "TextFile1.txt";
              StreamReader myReader = new StreamReader(fileName);
              while ((line = myReader.ReadLine()) != null &amp;&amp; i &lt; 4 )
              {
  
                  arrayReader[i] = line;
                  // Console.WriteLine(line);
  
                  //Console.WriteLine(arrayReader[i]);
                  i++;
  
              }
             unit.M_Question  = arrayReader[0];
              unit.M_Answers = arrayReader[1];
              unit.M_CorrectAnswers = arrayReader[2];
              unit.M_Explanation = arrayReader[3];
  
  
          }
  </code></pre>
  
  <p>Any ideas about how to do this ?</p>