LINQ-Distinct to remove duplicate elements from List.

This Function show you how to use Distinct to remove duplicate elements from List.

         public void DistinctExample()
        {

            int[] arr = { 1,2,3,4,2,1,3,5,4,6,4,2,1,9 };

            var uniqueValue = arr.Distinct();

            Console.WriteLine("Unqieuw Values :");
            foreach (var x in uniqueValue)
            {
                Console.WriteLine(x);
            }

        }