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/Bookmark

Tags: , , , , , ,

Read Users' Comments (1)

Solving Issues With LINQ Foreach Variables

Can you guess what the output of the following program is? using System; using System.Collections.Generic; namespace Lambda { class Program { static void Main(string[] args) { var strings = new[] {“a”, “b”, “c”}; var actions = CreateActions(strings); actions.ForEach(f => f()); } private static List CreateActions(IEnumerable strings) { var actions = new List(); foreach (var s [...]

  • Share/Bookmark

Tags: ,

Read Users' Comments (0)