I am trying to find a solution, in eliminating repetitive string names, say for ex.,
in a literal field, i am populating names of the contributor of certain article’s history version, and so, if “ron” has contributed to the versioning of an article 3 times, the name “ron” gets added to this literal control, and outputs “ron” 3 times.
I am trying to find, if a name is repeating twice, i should be able to populate it only one time. How can i achieve this ?
Depending on your setup, I’d either use a StringCollection and just check if the name exists prior to insertion or just add all the names to a List and call Distinct() (extension method in System.Linq). So either:
As CharithJ suggests, or:
Either would work well enough.