Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

UniqueKey Class

UniqueKey allows for generating keys unique to a type or particular instance and a partial name, that can e.g. be used as keys in Hashtable.

For a list of all members of this type, see UniqueKey Members .

System.Object
   UniqueKey

[Visual Basic]
<Serializable> _
<TypeConverter(ConverterTypeName:="Spring.Core.TypeConversion.UniqueKeyConverter, Spring.Core, Version=1.3.0.20214, Culture=neutral, PublicKeyToken=65e474d141e25e07")> _
Public NotInheritable Class UniqueKey
    Implements IEquatable(Of T)
[C#]
[Serializable]
[TypeConverter(ConverterTypeName="Spring.Core.TypeConversion.UniqueKeyConverter, Spring.Core, Version=1.3.0.20214, Culture=neutral, PublicKeyToken=65e474d141e25e07")]
public sealed class UniqueKey : IEquatable<T>

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Example

// shows usage type-scoped keys UniqueKey classAKey = UniqueKey.GetTypeScoped(typeof(ClassA), "myKey"); UniqueKey classBKey = UniqueKey.GetTypeScoped(typeof(ClassB), "myKey"); HttpContext.Current.Items.Add( classAKey, "some value unqiue for class A having key 'myKey'"); object value = HttpContext.Current.Items[ UniqueKey.GetTypeScoped(typeof(ClassA), "myKey") ]; Assert.AreEqual( "some value unique for class A having key 'myKey'", value); HttpContext.Current.Items.Add( classBKey, "some value unqiue for class B having key 'myKey'"); object value = HttpContext.Current.Items[ UniqueKey.GetTypeScoped(typeof(ClassB), "myKey") ]; Assert.AreEqual( "some value unique for class B having key 'myKey'", value);

Requirements

Namespace: Spring.Util

Assembly: Spring.Core (in Spring.Core.dll)

See Also

UniqueKey Members | Spring.Util Namespace