views:

292

answers:

3

i have a array-list who have a list of a type but all value is defined by two times

Means to say ex:-my blog url it's included in my arraylist two times

http://anirudhagupta.blogspot.com/

http://anirudhagupta.blogspot.com/

how i can remove it's duplicate copy from my arraylist

+3  A: 
arraylist.distinct();

Make sure you have using System.linq at the top of your cs file.

Ngu Soon Hui
are you write in detailed
A: 

Hey Anirudha,

The earlier answer is correct but just to add to it, you need to specify the type when you create the list. Arraylist does not have a distinct method by itself. Here is how you would do it,

List<string> foo = new List<string>();
foo.Add("sample");
foo.Add("sample");
...
IEnumerable bar = foo.Distinct();
theraneman
Are you define it in detailed
Im sorry but I did not understand what you are trying to say. Do you want a more detailed example?
theraneman