How I remove duplicates from something that implements IEnumerable<T>

by Mikael Henriksson 5. June 2010 18:32
I admit it does not work for everything and only in C# 4 but it’s a useful extension none the less. public static IEnumerable<T> RemoveDuplicates<T>(this IEnumerable<T> items) { return new HashSet<T>(items); } The hash set does not allow duplicates!

Tags: ,

LINQ | C#

Using extension methods to handle Xml

by Mikael Henriksson 16. February 2010 08:42
I have created a few very useful extension methods for handling the System.Xml.Linq namespace that I use all the time. I’ve had positive feedback on this before (and it showed up in this post) and now I had to create a couple of extra extensions just to make my life even easier. The way I work... [More]

Tags: , ,

C# | LINQ | Xml