Accessing IEnumerable elements or querying and query
Posted on 2008-10-29
Hopefully this is a quick one.
My application has two layers - application and data
The data layer in this case returns IEnumerable<Users> collection from the Users table. The collection has multiple fields as they are stored in the Users table.
So now I have this IEnumerable interface/collection with all User related fields but I needI only to pull the collection of userIDs and UserNames so later they can be assigned to the dropDownList.
I can't figure out how to pull just those two elements from the entire collection of stuff.
Keep in mind please that LInq DataContext classes are stored in the data layer and cannot be access from the program so something like this does not work:
var userNames = from u in userIEnumerable
I hope that I was clear, please let me know if something wasn't.