An IDictionary where keys are compared by object identity, rather than equals. All external users of this class need to have no knowledge of the IdentityKey - it is all hidden by this class.

Namespace: NHibernate.Util
Assembly: NHibernate (in NHibernate.dll) Version: 3.2.0.4000 (3.2.0.4000)

Syntax

C#
[SerializableAttribute]
public sealed class IdentityMap : IDictionary, 
	ICollection, IEnumerable
Visual Basic
<SerializableAttribute> _
Public NotInheritable Class IdentityMap _
	Implements IDictionary, ICollection, IEnumerable
Visual C++
[SerializableAttribute]
public ref class IdentityMap sealed : IDictionary, 
	ICollection, IEnumerable

Remarks

Do NOT use a System.Value type as the key for this Hashtable - only classes. See the google thread about why using System.Value is a bad thing.

If I understand it correctly, the first call to get an object defined by a DateTime("2003-01-01") would box the DateTime and return the identity key for the box. If you were to get that Key and unbox it into a DateTime struct, then the next time you passed it in as the Key the IdentityMap would box it again (into a different box) and it would have a different IdentityKey - so you would not get the same value for the same DateTime value.

Inheritance Hierarchy

System..::..Object
  NHibernate.Util..::..IdentityMap

See Also