I have a table that contains a list of
string and many item in the table have the same
string with a different
ID, Now I want to take all the items from the table but not more than one items with the same
id - string ------------------ 1 --- A 2 --- B 3 --- B 4 --- C 5 --- D 6 --- D 7 --- F
after the query the list should look like
A, B, C, D, F
How can I do that using LINQ?
You could do something like this, I suppose:
var result = Context.yourTable.Select(t => t.fieldName).Distinct();
So, basically, your query is getting only distinct values for 'fieldName' (whatever that may be in your case).