   [C#] Getting null exception but object is defined
  So I don't understand why this isn't working, I'm trying to add a class object to a list and it is throwing a null exception.  code below:public class Grid    {   public static int min = 0;   public static int max = Game1.map.levelHeight;   public static int cellSize = 128;   public static int width = (max-min)/cellSize;   public static int numberOfBuckets = width*width;   public List<QT.IQuadTreeItem>[] bucketList;   public Grid()   {  bucketList = new List<QT.IQuadTreeItem>[numberOfBuckets];   }   public void Insert(Rectangle rect, QT.IQuadTreeItem gridItem)   {  int gridCell = rect.X * 1 / cellSize + rect.Y * 1 / cellSize;  int gridCell3 = (rect.X + rect.Width) * 1 / cellSize +(rect.Y+rect.Height) * 1 / cellSize;  bucketList[gridCell].Add(gridItem);.......the null exception comes up at bucketlist.add, which is in the insert function called by the quadtree item update function itself and was defined and initialized but it wont let me add it into the list.. what is the reason I cannot add the gridItem?
  You create but never initialize the array.   ;  You initialized the array, but the individual elements of the array are automatically set to null. You'll have to create the elements with a separate call to new List<T>() before attempting to use that reference.   ;  bucketList references an array of List<QT.IQuadTreeItem>. Upon construction of the Grid, it is no longer null; instead it now references an array of numberOfBuckets List<QT.IQuadTreeItem> references. However, those references are still null.   