List<int> li = new List<int>() { 1, 1, 1, 1, 1, 1, 1, 2, 2 }; List<int> New = new List<int>(); foreach (int item in li) New.Add(item);
List<int> li = new List<int>() { 1, 1, 1, 1, 1, 1, 1, 2, 2 };// your original list containing duplicates</int></int>
List<int> distinct = li.Distinct().ToList();// new list containing only distinct values from above list..</int>
List<int> li = new List<int>() { 1, 1, 1, 1, 1, 1, 1, 2, 2 }; List<int> New = new List<int>(); foreach(int i in li) { if (!New.Contains(i)) New.Add(i); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)