c# 4.0 - Access the first object in grouby list of lists -


groupby creates list of lists of objects i'm sorting. need first element in each list

list<string> topfive = listofobjects.groupby(x=>x.names).orderbydescending(x=>x.count())... 

ok, have list of objects, in descending order how many objects in each list. need retrieve 1 object each list, i.e. need retrieve first object in each nested list , put in new list can .select .names property

the confusion arising fact groupby creating list there multiple objects in list, list in element of external list. need extract 1 object each nested list

i have been scanning stack overflow last 2 hours , lack keywords find relevant answer.

this best guess doesn't work

list<string> topfive = listofobjects.groupby(x => x.names).orderbydescending(x => x.count()).select(x => x.select(y => y.names)); 

have tried:

topfive.first().names 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -