Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string[] OutputArray = MyArray.Distinct().ToArray();
- int[] test = { 1, 2, 1, 3, 3, 4, 5 };
- var res = (from t in test select t).Distinct<int>();
- foreach (var i in res)
- {
- Console.WriteLine(i);
- }
- 1
- 2
- 3
- 4
- 5
- string[] myarray = new string[] { "aaa", "bbb", "aaa" };
- Dictionary mydict = new Dictionary();
- foreach (string s in myarray) {
- if (!mydict.ContainsKey(s)) mydict.Add(s, s);
- }
Add Comment
Please, Sign In to add comment