c# - Need help for a complex linq query -
ok i've got datatable here's schema
datatable dt = new datatable(); dt.columns.add("word", typeof(string)); dt.columns.add("pronunciation", typeof(string));
the table filled , i'm trying make linq query can output console or anywhere :
pronunciation : akses9~r => (list of words)
i want output pronunciations common , words use it.
something should give want:
var results = dt.groupby(dr => dr.pronunciation); foreach(var result in results) { console.write("pronunciation : {0} =>", result.key); foreach(var word in result) { console.write("{0} ", word); } console.writeline(); }
the groupby gives igrouping key property contain pronunciation , collection contain words.
Comments
Post a Comment