.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 are the methods “public override bool equals(object obj)” and “public override int gethashcode()” doing? [closed]

Most types in .NET derive from the type System.Object, simply called object in C#. (E.g. interfaces don’t, however their implementations do.) System.Object declares the methods Equals and GetHashCode as well as other members. (Note: The case matters in C#). The types you create automatically inherit these methods. The task of Equals is to compare an … Read more