-
February 3rd, 2010, 04:25 AM
#1
[RESOLVED] A list in a list
Can anyone please tell me what this error means and how to fix it
Products.Add(new product());
Products[0].Code = "ANW135";
Products[0].Description = "Coffee Mug";
Products[0].Batch.Add(new batch());
// The above line has the following error when I run the program
// Error = System.NullReferenceException was unhandled
// Message="Object reference not set to an instance of an object."
class product
{
public String Code;
public String Description;
public List<batch> Batch;
}
class batch
{
public Int64 Cost;
public Int64 Rebate;
public Int64 Freight;
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|