title: C# how to populate list of lists
body: <p>I am attempting to create a class of lists </p>
  
  <pre><code> public class comparisonData
  {
      public List&lt;string&gt; Tables { get; set; }
      public List&lt;string&gt; Constraints { get; set; }
      public List&lt;string&gt; StoredProcs { get; set; }
      public List&lt;string&gt; Views { get; set; }
      public List&lt;string&gt; Functions { get; set; }
      public List&lt;string&gt; Columns { get; set; }
      public List&lt;string&gt; Synonyms { get; set; }
      public List&lt;string&gt; NotNullables { get; set; }
  
  
  }
  </code></pre>
  
  <p>And then instantiate said class as a list  </p>
  
  <pre><code>List&lt;comparisonData&gt; cList = new List&lt;comparisonData&gt;();
  </code></pre>
  
  <p>My end goal is to have a list of several different database names which each have Lists that contain said databases table names, columns, constraints etc.</p>
  
  <p>However I am receiving an "Index was out of range. Must be non-negative and less than the size of the collection" error when I try to populate my lists</p>
  
  <pre><code>        while(reader.Read())
          {
              cList[0].Tables.Add(reader.GetString(0));
          }
  </code></pre>
  
  <p>Am I instantiating something wrong? Or is this list of lists just bad code and I should pursue a different mean to my end goal? </p>