title: Store data in list with array from class. C#
body: <p>I cant seem to find the proble, therefore i hope someone out there would be able to guide me to where my mistake is.</p>
  
  <pre><code>private List&lt;BoxClass&gt;[] Box = new List&lt;BoxClass&gt;[250];
  
  public class BoxClass
  {
          public string amountvalue { get; set; }
          public string amountname { get; set; }
  }
  
  private int totalcount = 10;
  
  private void loadvalues()
  {
  for(int i = 0; i &lt; totalcount; i++)
  {
      Box[i].Add(new BoxClass()
      {
          amountvalue = mySqlDataReader["amountvalue"].ToString(),
          amountname = mySqlDataReader["amountname"].ToString(),
      };
  }
  }
  </code></pre>
  
  <p>Error i get in the debugger in Visual Studio is 
  "{System.NullReferenceException: The object reference is not set up to receive an object" &lt;- its translated from danish, since I am using windows in Danish which also gives me the error description in danish also.</p>
  
  <p>There shoudnlt be null bassed or i might misunderstand the error message?</p>
  
  <p>I need to have 250 Box, and in each of the box i need to store amount and values which are coming from a SQL datatable, which works fine if i store everything in a array of strings and load them one by one, but i need them to be stored in list (better than having 6 strings with arrays under each of them)</p>
  
  <p>I thank you all for any help.</p>