Hello everyone,
I have a string array, but may have duplicate strings. Any built-in or smart way to remove the duplicate ones and generate a string array contains only unique ones?
For example, the input array is {"abc", "bcd", "abc"}, the unique output array is {"abc", "bcd"}.
thanks in advance,
George
George GeorgePosted Dec 23, 2008, 1:46 AM
Thanks Jan!
I like your solution!
regards,
George
Jan MontanoPosted Dec 23, 2008, 12:54 AM
string[] array = new string[]{"one","two","three","two","four","one","five"};
List
for (int i=0; i
if (!list.Contains(array[i])) list.Add(array[i]);
}
string[] newArray = list.ToArray();