Hate Code
Showing posts with label
Duplicate Values
.
Show all posts
Showing posts with label
Duplicate Values
.
Show all posts
Friday, 8 June 2012
How to Find the Duplicate Values in ArrayList
contacts.Sort();
for (int i=1; i <= contacts.Count-1; i++)
{
Console.WriteLine(contacts[ i ]);
Console.WriteLine(contacts[ i-1] );
if(contacts[ i ].ToString() == contacts[ i-1 ].ToString())
{
Console.WriteLine("Duplicate: "+contacts[ i ]);
}
}
Older Posts
Home
Subscribe to:
Posts (Atom)