I have an ArrayList
of email addresses. I want to remove duplicates from it.
For example my array list is:
I want output like this
I have an ArrayList
of email addresses. I want to remove duplicates from it.
For example my array list is:
I want output like this
Something like this:
ArrayList arr = new ArrayList { "[email protected]", "[email protected]",
"[email protected]", "[email protected]" };
var res = arr.ToArray().GroupBy(c => c.ToString().Split('@')[1])
.Select(c=> c.FirstOrDefault()).ToArray();
I used an ArrayList
to adjust with your question, but it would be better to use a List
or Array
of string
instead.