I need a list of unique values. But it could be, the values exists twice or more in the list.
If this occurs I must rename the value but the renamed value also could be in the list.
It is possible to rename the values using a LINQ query so i don’t need a sub-query?
example 1:
before:
“one”, “one”, “two”, “two”, “three”
after:
“one”, “one_”, “two”, “two_”, “three”
example 2:
before:
“one”, “one”, “one_”
after:
“one”, “one_”, “one__”
The 3rd “one” has 2 underscores because the 2nd “one” was renamed to “one_”.
Thanks a lot for an idea…
I don’t think this should be done with simply a linq-query. I’d use a HashSet and create a function if I was you. Something like this:
[Edit]
This could be made into an extension-method though, so you could call it like this:
myList.GetUnique();(or something like that)[Edit 2]
Fixed bug with iterator-variable being changed.