I've created a set of custom classes to contain some information I need, in specific order. Each class, besides the last class, contains an array of the class underneath it.
The custom classes are as follows.
public class Quote
{
public int ServiceQuoteId;
public bool Begin = new bool();
public PricingGroup[] PricingOptionGroup = new PricingGroup[10];
}
public class PricingGroup
{
public int ItemId;
public string ALocation;
public bool LocSet = new bool();
public Product[] Group = new Product[10];
}
public class Product
{
public int Total1;
public ProductGroup[] Set = new ProductGroup[10];
public string Term;
}
public class ProductGroup
{
public string Product;
public int Charge;
public bool Option = new bool();
}
After creating an instance of the object, like this (below)
Quote testQuote = new Quote();
I try to test one of the boolean values like this (below.
if (!testQuote.PricingOptionGroup[0].LocSet)
But this gives me this error.
"An exception of type 'System.NullReferenceException' occurred in WebApplication3.dll but was not handled in user code
Additional information: Object reference not set to an instance of an object."
What I'm trying to do might not be possible; but logically I believe it makes sense. To my understanding, new bool() initializes to false.