Forums - C# Corner

Forum guidelines
Deepali Patil

Deepali Patil

  • 679
  • 84
  • 42.7k

Hi, I am trying to remove duplicate elements from the integer array. Please see my code.

Nov 25 2012 8:34 AM
   Console.WriteLine("Enter the number");
            int num = Convert.ToInt32(Console.ReadLine());
            int[] array = new int[num];
            Array.Sort(array);
            for(int i = 0;i < array[i] ;i++)
            {
                if (array[0] == array[i])
                { 
                }
            }


I have sorted and i am comparing every element of the array with the next element.
But how to remove the duplicate element??


Answers (1)

C# Corner Chandigarh Developer Conference

SPONSORED BY

Spire.Doc - Free .NET Word API
Use Spire.Doc to create, read, write, print, and convert word documents to OpenXML, RTF, TXT, XPS, EPUB, EMF, HTML, Image and PDF.