c# - Is there any elegant way in LINQ to bucket a collection into a set of lists based on a property -


i have collection of cars. want bucket separate lists property of car . . .lets brand.

so if have collection of ford, chevy, bmw, etc, want seperate list each of buckets.

something like:

ienumberable<car> mycarcollection = getcollection();  list<ienumerable<car>> buckets = mycarcollection.bucketby(r=>r.brand) 

does exist or need "manually" through loops

return mycarcollection.groupby(r => r.brand); 

Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -