Skip to content

Tag Archives: reference-types

All types are not compared equally (part 2)

18-Mar-10

In part 1 of this series I explained the difference between reference equality and value equality. In this article I am going to demonstrate how to compare two reference types using value equality semantics. Override Object.Equals Every time you use the binary equality operator (==) or the Equals method on a reference type you are [...]

All types are not compared equally

29-Oct-09

Here is a bit of a quiz: What does this program print? using System; using System.Collections.Generic; class Person { public String Name { get; set; } } class Example { static void Main() { var people = new List<Person> { new Person { Name = “George Washington” } }; Console.WriteLine( people.Contains( new Person { Name [...]