I have a list object that is returning 3 customer phone as a list like:
[0] "3104058879"
[1] "Work"
[2] "646546454"
[3] "Mobile"
in my code:
var phone= dal.Get_CustomerPhone(customer.Customer_ID, "Phone");
customer.WorkPhone = phone.Phone_Numbers[0]; //work phone
customer.HomePhone = phone.Phone_Numbers[2]; //HomePhone
customer.MobilePhone = phone.Phone_Numbers[4]; //Mobile phone
if for example the Mobilephone is empty so it is not in the object, I am getting null error. How I can prevent it.
Go to the complete details ...