How to Use .Except with EqualityComparer

Today we’re going to cover an advanced scenario where we need to compare lists of a class we created. We’ll start with an implementation of EqualityComparer<T> which consists of overriding two methods: Equals and GetHashCode. What was a little tricky about this implementation is this subtle, but critical, comment in the code sample on MSDN [...]

Share

Tags: , , , , , ,

Read Users' Comments (1)

How to Use IDisposable with LINQ

Objects that implement IDisposable are everywhere. The interface even gets its own language features (C#, VB, F#). However, LINQ throws a few wrenches into things: LINQ’s query syntax depends on expressions; using blocks are statements. When querying a sequence of IDisposable objects, there’s no easy way to ensure disposal after each element has been consumed. [...]

Share

Tags: , , , ,

Read Users' Comments (0)