DictionaryBase<TKey, TValue> Class
Provides a base class for generic dictionary.
public abstract class DictionaryBase<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable
Public MustInherit Class DictionaryBase(Of TKey, TValue)
Implements IDictionary(Of TKey, TValue), ICollection(Of KeyValuePair(Of TKey, TValue)), IEnumerable(Of KeyValuePair(Of TKey, TValue)), IEnumerable
Type Parameters
TKey
The type of the key.
TValue
The type of the value.
- Inheritance:
- System.ObjectDictionaryBase<TKey, TValue>
- Derived
Implements
Remarks
This class is used as a base class for BuiltInDocumentPropertiesDictionary, CustomDocumentPropertiesDictionary and FieldMappingDictionary classes.
Properties
Count
Gets the number of key/value pairs contained in the DictionaryBase<TKey, TValue>.
Property Value
- System.Int32
The number of key/value pairs contained in the DictionaryBase<TKey, TValue>.
Item[TKey]
Gets or sets the value associated with the specified key.
Parameters
key
- TKey
The key of the value to get or set.
Property Value
- TValue
The value associated with the specified key.
Keys
Gets a collection containing the keys in the DictionaryBase<TKey, TValue>.
Property Value
- System.Collections.Generic.ICollection<TKey>
A collection containing the keys in the DictionaryBase<TKey, TValue>.
Values
Gets a collection containing the values in the DictionaryBase<TKey, TValue>.
public ICollection<TValue> Values { get; }
Public ReadOnly Property Values As ICollection(Of TValue)
Property Value
- System.Collections.Generic.ICollection<TValue>
A collection containing the values in the DictionaryBase<TKey, TValue>.
Methods
Add(TKey, TValue)
Adds the specified key and value to the DictionaryBase<TKey, TValue>.
Parameters
key
- TKey
The key of the element to add.
value
- TValue
The value of the element to add.
Clear()
Removes all keys and values from the DictionaryBase<TKey, TValue>.
ContainsKey(TKey)
Determines whether the DictionaryBase<TKey, TValue> contains the specified key.
Parameters
key
- TKey
The key to locate in the DictionaryBase<TKey, TValue>.
Returns
- System.Boolean
true
if the DictionaryBase<TKey, TValue> contains an element with the specified key; otherwise, false
.
GetEnumerator()
Returns an enumerator that iterates through the DictionaryBase<TKey, TValue>.
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of KeyValuePair(Of TKey, TValue))
Returns
- System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>>
An enumerator that can be used to iterate through the DictionaryBase<TKey, TValue>.
Remove(TKey)
Removes the value with the specified key from the DictionaryBase<TKey, TValue>.
Parameters
key
- TKey
The key of the element to remove.
Returns
- System.Boolean
true
if the element is successfully found and removed; otherwise, false
. This method returns false
if key is not found in the DictionaryBase<TKey, TValue>.
TryGetValue(TKey, out TValue)
Gets the value associated with the specified key.
public bool TryGetValue(TKey key, out TValue value)
Public Function TryGetValue(key As TKey, ByRef value As TValue) As Boolean
Parameters
key
- TKey
The key of the value to get.
value
- TValue
When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value
parameter. This parameter is passed uninitialized.
Returns
- System.Boolean
true
if the DictionaryBase<TKey, TValue> contains an element with the specified key; otherwise, false
.