what is fastest way to remove duplicate values from a list. Assume List longs = new List { 1, 2, 3, 4, 3, 2, 5 }; So I am interesting in
List longs = new List { 1, 2, 3, 4, 3, 2, 5 };
A simple intuitive implementation
public static List RemoveDuplicates(List listPoints) { List result = new List(); for (int i = 0; i < listPoints.Count; i++) { if (!result.Contains(listPoints[i])) result.Add(listPoints[i]); } return result; }