Class problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have this little test class:

public class Item
{

private int iID = 0;


public int tID
{
get { return iID; }
set { iID = value; }
}
}

when i declare it like this, everything works:
Item mTest = new Item();
mTest.tID = 0;

when i declare it like this:
Item[] mTest = new Item[3];
mTest[0].tID = 0;

i get this error:
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Anyone know why?
 
Back
Top