I am wondering if any one could help me, basically I am trying to flatten a list using linq. Inside the list is an array of phone numbers, What I can not figure out to do is count the size of the array and add each phone number as a unique list value.
var FlatenedList = from x in result
where x.ID != null
orderby x.ID
select new
{
AccountNumber = x.AccountNumber,
Balance = x.Balance,
BillToCompanyName = x.BillToContact.CompanyName,
BillToName = x.BillToContact.Name,
BillToPhoneNumber1 = x.BillToContact.PhoneNumbers[0].Number == null ? String.Empty : (x.BillToContact.PhoneNumbers[0].Number),
BillToPhoneNumber2 = x.BillToContact.PhoneNumbers[1].Number == null ? String.Empty : (x.BillToContact.PhoneNumbers[1].Number),
BillToPhoneNumber3 = x.BillToContact.PhoneNumbers[2].Number == null ? String.Empty : (x.BillToContact.PhoneNumbers[2].Number),
};