Is there a complete IEquatable implementation reference?

Implementing IEquatable<T> for a Value Type Implementing IEquatable<T> for a value type is a little bit different than for a reference type. Let’s assume we have the Implement-Your-Own-Value-Type archetype, a Complex number struct. public struct Complex { public double RealPart { get; set; } public double ImaginaryPart { get; set; } } Our first step … Read more

.NET unique object identifier

.NET 4 and later only Good news, everyone! The perfect tool for this job is built in .NET 4 and it’s called ConditionalWeakTable<TKey, TValue>. This class: can be used to associate arbitrary data with managed object instances much like a dictionary (although it is not a dictionary) does not depend on memory addresses, so is … Read more

What’s the role of GetHashCode in the IEqualityComparer in .NET?

A bit of background first… Every object in .NET has an Equals method and a GetHashCode method. The Equals method is used to compare one object with another object – to see if the two objects are equivalent. The GetHashCode method generates a 32-bit integer representation of the object. Since there is no limit to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)