I have this C # code that builds a comma-separated string of matches for a service:
for (m = r.Match(site); m.Success; m = m.NextMatch())
{
found = found + "," + m.Value.Replace(",", "");
}
return found;
The output looks like this: aaa, bbb, ccc, aaa, 111,111, ccc
Now this code is in .NET 4.0. How can I use C # LINQ to remove duplicates?
Also, any way to remove duplicates without changing the order?
I found this sample code in another post, but I don’t know exactly how to apply it:
int[] s = { 1, 2, 3, 3, 4};
int[] q = s.Distinct().ToArray();
Thank.
source
share