How to get distinct values from an array in C#?

Views: 394
Created Date: 12-Sep-2016

[C#]

public int[] GetDistinctValues(int[] arr)

{
List<int> lst = new List<int>();
for (int i = 0; i < arr.Length; i++)
{
if (lst.Contains(arr))
continue;
lst.Add(arr);
}
return lst.ToArray();
}

Similar Tags
0.0 0