public static string[] RemoveDuplicates(string[] s)
{
HashSet set = new HashSet(s);
string[] result = new string[set.Count];
set.CopyTo(result);
return result;
}
When you use HashSet, you need to import System.Collections.Generic and add Reference (System.Core).
Thank you very much.
string[] result = new string[set.Count];
set.CopyTo(result);
return result;
}
When you use HashSet
Thank you very much.
No comments:
Post a Comment
If this post is useful, pls comment here.