I want to remove duplicate value remain one with LINQ
Example:
{2,4,5,2,6,2,8,6,9}
Result:
{4,5,2,8,6,9}
I want to remove duplicate value remain one with LINQ
Example:
{2,4,5,2,6,2,8,6,9}
Result:
{4,5,2,8,6,9}
Assuming your list is like:
var x = new List<int> {2,4,5,2,6,2,8,6,9};
You can distinct it:
var y = x.Distinct();
If you need the result as a List<T>
rather than an enumerable, ToList() it (but if all you're doing is eg looping over it, don't bother: foreach(var unique in x.Distinct())
)