You can use GroupBy
var data = DB.tblDocumentTypes.GroupBy(m => m.Doc_Type).Select(x => x.First());
Frage
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();
Lösung
You can use GroupBy
var data = DB.tblDocumentTypes.GroupBy(m => m.Doc_Type).Select(x => x.First());