Warning : Customer.Customer() Non-nullable property 'CustomerItemList' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. How to resolve this problem?
class Customer : Inventory
{
public List<string> CustomerItemList { get; set;} //warning occurred in this line
public List<Customer> getCustomerList(){
List<Customer> customers = new List<Customer>();
List<string> customerItemList1 = new List<string>();
List<string> customerItemList2 = new List<string>();
List<string> customerItemList3 = new List<string>();
customerItemList1.Add("INDHS");
customerItemList1.Add("INOPL");
customerItemList2.Add("INCDS");
customerItemList2.Add("INWSZ");
customerItemList3.Add("INOPL");
customerItemList3.Add("INQAB");
customers.Add(new Customer { CutomerId = "CUABC", CutomerName = "Bala", CustomerItemList = customerItemList1, InventoryQty = 25 });
customers.Add(new Customer { CutomerId = "CUWDZ", CutomerName = "Manju", CustomerItemList = customerItemList2, InventoryQty = 12 });
customers.Add(new Customer { CutomerId = "CUQOP", CutomerName = "Chandru", CustomerItemList = customerItemList3, InventoryQty = 10 });
return customers;
}
}