title: Accessing Objects inside lists
body: <p>I am making a 'Quiz type' program, where the questions are read from a file, stored as objects and then stored in a list.
  I have no idea how to check if they have been stored correctly, so I'll post the storage code too.</p>
  
  <p>My problem is that I seem not to be able to access any of the data I have stored.
  For example:</p>
  
  <pre><code>vartrack.Questions[0].MultipleChoice;
  </code></pre>
  
  <p>This should return true or false?
  But for some reason I cannot access the MultipleChoice data.</p>
  
  <p>My code is as follows:
  Class code:</p>
  
  <pre><code>public class QuizQuestions
  {
      public bool MultipleChoice = false;
      public string questiontext;
      public static List&lt;string&gt; Answers = new List&lt;string&gt;();
      public bool correct;
      public QuizQuestions(string QuestionText)
      {
          questiontext = QuestionText;
      }
      public void AddAnswer(string answer)
      {
          Answers.Add(answer);
          if (Answers.Count &gt; 1)
          {
              MultipleChoice = true;
          }
      }
  }
  </code></pre>
  
  <p>The rest of the code:</p>
  
  <pre><code>foreach(string currentline in vartrack.QuestionLines)
              {
                  if (Question)
                  {
                      current = new QuizQuestions(currentline);
                      vartrack.Questions.Add(current);
                      Question = false;
                  }
                  else
                  {
                      if (currentline == "#")
                      {
                          Question = true;
                      }
                      else
                      {
                          if (current != null)
                          {
                             current.AddAnswer(currentline);
                          }
                      }
                  }
              }
              int num;
              while (vartrack.Questions.Count &gt; inputNoOfQs.Value)
              {
                  Random random = new Random();
                  num = random.Next(0, vartrack.Questions.Count);
                  vartrack.Questions.RemoveAt(num);
              }
              vartrack.Questions[0].MultipleChoice;
  </code></pre>
  
  <p>Thanks</p>
  
  <p>EDIT 1:
  Vartrack is defined here:</p>
  
  <pre><code>    public static class vartrack
  {
      public static string[] QuestionSets;
      public static List&lt;string&gt; QuestionLines = new List&lt;string&gt;();
      public static List&lt;object&gt; Questions = new List&lt;object&gt;();
  
  }
  </code></pre>