質問

Actually I want to get the full table but it should be based on Doc_Type==distinct

Means it should only pick the records from table that has unique Doc_Type. I have tried with following but it returns me a single column into tolist() but I want to get full table. How can I do it?

var data = DB.tblDocumentTypes.Select(m => m.Doc_Type).Distinct().ToList();
役に立ちましたか?

解決

You can use GroupBy

 var data = DB.tblDocumentTypes.GroupBy(m => m.Doc_Type).Select(x => x.First());
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top