Class problem

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top