Use a HashSet<T>. For example:

var items = "A B A D A C".Split(' ');
var unique_items = new HashSet<string>(items);
foreach (string s in unique_items)
    Console.WriteLine(s);
A 
B
D
C

Last modified: March 21, 2019

Author

Comments

Write a Reply or Comment