C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




how to delete duplicates in an array


Posted Date: 05 Sep 2008      Total Responses: 3

Posted By: ratna       Member Level: Bronze     Points: 1



hi
i want to remove duplcate values from an array .
help me





Responses

Author: Praveen    05 Sep 2008Member Level: GoldRating:     Points: 3

ArrayList arr= new ArrayList();
int loop;
/// intialization of array

for(loop=0;loop<arr.Count;arr++)
{
if(arr.Contains(arr[loop]))
{
arr.RemoveAt(loop);
}
}

hope this will help u



Author: Vidhya    05 Sep 2008Member Level: GoldRating:     Points: 2

hi,

The below code is in vb script. Refer this code:

Dim noDupsArrList As New ArrayList()
For i As Integer = 0 To items.Length - 1
If Not noDupsArrList.Contains(items(i).Trim()) Then
noDupsArrList.Add(items(i).Trim())
End If
Next

Dim uniqueItems As String() = New String(noDupsArrList.Count - 1) {}
noDupsArrList.CopyTo(uniqueItems)
Return uniqueItems

Regards,
Vidhya



Author: sirisha choudhary    05 Sep 2008Member Level: SilverRating:     Points: 2

take Hash Table instead of Array it will helps u ,

Hash table doesnt allow duplicate values



Post Reply
You must Sign In to post a response.
Next : how to create a table row dynamically from the base & derived class?
Previous : paypal integration
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use