J
jehugaleahsa
Hello:
Have you ever wanted a list of customer IDs, but had to get a list of
Customers first?
I am pretty conscientious about style and good variable names, so I am
wonder what other people do in certain situations when a temporary or
middle step is necessary.
IEnumerable<Customer> customers = getCustomers();
List<Customer> listOfCustomers = new List<Customer>(customers);
List<int> customerIds = listOfCustomers.ConvertAll<int>(delegate
(Customer current)
{
return current.ID;
});
listOfCustomers seems dirty to me. I mean, I could make that one line
of code, but then readibility suffers.
Just curious if other people have a better naming convention.
Thanks,
Travis
Have you ever wanted a list of customer IDs, but had to get a list of
Customers first?
I am pretty conscientious about style and good variable names, so I am
wonder what other people do in certain situations when a temporary or
middle step is necessary.
IEnumerable<Customer> customers = getCustomers();
List<Customer> listOfCustomers = new List<Customer>(customers);
List<int> customerIds = listOfCustomers.ConvertAll<int>(delegate
(Customer current)
{
return current.ID;
});
listOfCustomers seems dirty to me. I mean, I could make that one line
of code, but then readibility suffers.
Just curious if other people have a better naming convention.
Thanks,
Travis