Class NamedTagsDictionary
Represents a dictionary that can be associated with cache items to provide extra information so that items are grouped together and can be queried efficiently based on the provided information.
Inheritance
Assembly: Alachisoft.NCache.Runtime.dll
Syntax
public class NamedTagsDictionary : INamedTagTypeRetrieval
Remarks
One dictionary can be associated with each cache item that might contain multiple the named tags.
Constructors
NamedTagsDictionary()
Initializes the NamedTagsDictionary object.
Declaration
public NamedTagsDictionary()
Properties
Count
It returns the number of items in the NamedTagsDictionary.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 | Number of items in the NamedTagsDictionary. |
Examples
The following example prints the number of tags.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", int.MaxValue);
Console.WriteLine("Number of the named tags: " + tags.Count);
Methods
Add(String, Boolean)
Adds a boolean value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, bool value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Boolean | value | Boolean value of an item. |
Examples
The following example adds named tag of bool type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", false);
Add(String, Byte)
Adds a byte value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, byte value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Byte | value | Byte value of an item. |
Examples
The following example adds named tag of byte type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", int.MaxValue);
Add(String, Char)
Adds a character value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, char value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Char | value | Char value of an item. |
Examples
The following example adds named tag of character type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", 'a');
Add(String, DateTime)
Adds a DateTime value against a key in the the NamedTagsDictionary.
Declaration
public void Add(string key, DateTime value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.DateTime | value | DateTime value of an item. |
Examples
The following example adds named tag of DateTime type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", DateTime.Now);
Add(String, Decimal)
Adds a decimal value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, decimal value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Decimal | value | Decimal value of an item. |
Examples
The following example adds named tag of decimal type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", decimal.MaxValue);
Add(String, Double)
Adds a double value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, double value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Double | value | Double value of an item. |
Examples
The following example adds named tag of double type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", double.MaxValue);
Add(String, Int16)
Adds a short value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, short value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Int16 | value | Short value of an item. |
Examples
The following example adds named tag of short type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", int.MaxValue);
Add(String, Int32)
Adds an integer value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, int value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Int32 | value | Integer value of an item. |
Examples
The following example adds named tag of integer type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", int.MaxValue);
Add(String, Int64)
Adds a long value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, long value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Int64 | value | Long value of an item. |
Examples
The following example adds named tag of long type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", long.MaxValue);
Add(String, Nullable<Boolean>)
Adds a boolean value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, bool? value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Nullable<System.Boolean> | value | Boolean value of an item. |
Examples
The following example adds named tag of boolean type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", false);
Add(String, Nullable<Byte>)
Adds a byte value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, byte? value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Nullable<System.Byte> | value | Byte value of an item. |
Examples
The following example adds the named tag of byte type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", int.MaxValue);
Add(String, Nullable<Char>)
Adds a character value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, char? value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Nullable<System.Char> | value | Char value of an item. |
Examples
The following example adds named tag of character type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", 'a');
Add(String, Nullable<DateTime>)
Adds a DateTime value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, DateTime? value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Nullable<System.DateTime> | value | DateTime value of an item. |
Examples
The following example adds named tag of DateTime type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", DateTime.Now);
Add(String, Nullable<Decimal>)
Adds a decimal value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, decimal? value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Nullable<System.Decimal> | value | Decimal value of an item. |
Examples
The following example adds named tag of decimal type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", decimal.MaxValue);
Add(String, Nullable<Double>)
Adds a double value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, double? value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Nullable<System.Double> | value | Double value of an item. |
Examples
The following example adds named tag of double type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", double.MaxValue);
Add(String, Nullable<Int16>)
Adds a short value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, short? value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Nullable<System.Int16> | value | Short value of an item. |
Examples
The following example adds the named tag of a short type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", int.MaxValue);
Add(String, Nullable<Int32>)
Adds an integer value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, int? value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Nullable<System.Int32> | value | Integer value of an item. |
Examples
The following example adds named tag of integer type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", int.MaxValue);
Add(String, Nullable<Int64>)
Adds a long value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, long? value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Nullable<System.Int64> | value | Long value of an item. |
Examples
The following example adds named tag of long type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", long.MaxValue);
Add(String, Nullable<SByte>)
Adds a sbyte value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, sbyte? value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Nullable<System.SByte> | value | Sbyte value of an item. |
Examples
The following example adds named tag of sbyte type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", sbyte.MaxValue);
Add(String, Nullable<Single>)
Adds a float value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, float? value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Nullable<System.Single> | value | Float value of an item. |
Examples
The following example adds named tag of float type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", float.MaxValue);
Add(String, Nullable<UInt16>)
Adds a ushort value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, ushort? value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Nullable<System.UInt16> | value | ushort value of an item. |
Examples
The following example adds named tag of ushort type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", ushort.MaxValue);
Add(String, Nullable<UInt32>)
Adds a uint value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, uint? value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Nullable<System.UInt32> | value | uint value of an item. |
Examples
The following example adds named tag of uint type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", uint.MaxValue);
Add(String, Nullable<UInt64>)
Adds a ulong value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, ulong? value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Nullable<System.UInt64> | value | ulong value of an item. |
Examples
The following example adds named tag of ulong type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", ulong.MaxValue);
Add(String, SByte)
Adds sbyte value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, sbyte value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.SByte | value | Sbyte value of an item. |
Examples
The following example adds named tag of sbyte type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", sbyte.MaxValue);
Add(String, Single)
Adds a float value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, float value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.Single | value | Float value of an item. |
Examples
The following example adds named tag of float type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", float.MaxValue);
Add(String, String)
Adds a string value against a key in the the NamedTagsDictionary.
Declaration
public void Add(string key, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.String | value | String value of an item. |
Examples
The following example adds named tag of string type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", "Tag1_Value");
Add(String, UInt16)
Adds a ushort value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, ushort value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.UInt16 | value | ushort value of an item. |
Examples
The following example adds named tag of ushort type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", ushort.MaxValue);
Add(String, UInt32)
Adds a uint value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, uint value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.UInt32 | value | uint value of an item. |
Examples
The following example adds named tag of uint type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", uint.MaxValue);
Add(String, UInt64)
Adds a ulong value against a key in the NamedTagsDictionary.
Declaration
public void Add(string key, ulong value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
System.UInt64 | value | ulong value of an item. |
Examples
The following example adds named tag of ulong type.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", ulong.MaxValue);
Contains(String)
This method searches for the key in the NamedTagsDictionary and returns true, if it is found and false, in other case.
Declaration
public bool Contains(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Searches this key in NamedTagsDictionary. |
Returns
Type | Description |
---|---|
System.Boolean | True, if key found, and false, in other case. |
Examples
The following example verifies if the tags dictionary contains a tag.
NamedTagsDictionary tags = new NamedTagsDictionary();
if(!tags.Contains("Tag1"))
{
tags.Add("Tag1", int.MaxValue);
}
GetEnumerator()
Returns an enumerator that iterates through the entries of the NamedTagsDictionary.
Declaration
public IEnumerator GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator | IEnumerator of the the NamedTagsDictionary. |
Examples
The following example gets enumerator of the NamedTagsDictionary.
NamedTagsDictionary tags = new NamedTagsDictionary();
IEnumerator tagsEnumerator = tags.GetEnumerator();
Remove(String)
Removes the key value pair from the NamedTagsDictionary.
Declaration
public void Remove(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of an item. |
Examples
The following example removes a named tag.
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("Tag1", int.MaxValue);
tags.Remove("Tag1");
Explicit Interface Implementations
INamedTagTypeRetrieval.GetTypeInternal(Object)
Declaration
object INamedTagTypeRetrieval.GetTypeInternal(object key)
Parameters
Type | Name | Description |
---|---|---|
System.Object | key |
Returns
Type | Description |
---|---|
System.Object |