Monday 27 May 2019

MVC - C# - How to remove duplicates from the array


Watch this example on YouTube


   
        int[] a = { 1, 2, 3, 2, 3, 1, 5, 5, 6 };
        int[] b = a.Distinct().ToArray();

or 

        int[] a = { 1, 2, 3, 2, 3, 1, 5, 5, 6 };
        a = a.Distinct().ToArray();

No comments:

Post a Comment