Class NonGenericDictionary
Represents a non generic dictionary.
public class NonGenericDictionary : IDictionary, ICollection, IEnumerable
- Inheritance
-
NonGenericDictionary
- Implements
- Inherited Members
Constructors
NonGenericDictionary(IDictionary)
Initializes a new instance of the NonGenericDictionary class.
public NonGenericDictionary(IDictionary dictionary)
Parameters
dictionary
IDictionaryThe dictionary to use.
Fields
Dictionary
The actual dictionary used.
protected readonly IDictionary Dictionary
Field Value
Properties
Count
Gets the number of elements contained in the ICollection.
public int Count { get; }
Property Value
- int
The number of elements contained in the ICollection.
IsFixedSize
Gets a value indicating whether the IDictionary object has a fixed size.
public bool IsFixedSize { get; }
Property Value
- bool
true if the IDictionary object has a fixed size; otherwise, false.
IsReadOnly
Gets a value indicating whether the IDictionary object is read-only.
public bool IsReadOnly { get; }
Property Value
- bool
true if the IDictionary object is read-only; otherwise, false.
IsSynchronized
Gets a value indicating whether access to the ICollection is synchronized (thread safe).
public bool IsSynchronized { get; }
Property Value
- bool
true if access to the ICollection is synchronized (thread safe); otherwise, false.
this[object]
Gets or sets the element with the specified key.
public object this[object key] { get; set; }
Parameters
key
objectThe element key.
Property Value
- object
The element with the specified key.
Keys
Gets an ICollection object containing the keys of the IDictionary object.
public ICollection Keys { get; }
Property Value
- ICollection
An ICollection object containing the keys of the IDictionary object.
SyncRoot
Gets an object that can be used to synchronize access to the ICollection.
public object SyncRoot { get; }
Property Value
- object
An object that can be used to synchronize access to the ICollection.
Values
Gets an ICollection object containing the values in the IDictionary object.
public ICollection Values { get; }
Property Value
- ICollection
An ICollection object containing the values in the IDictionary object.
Methods
Add(object, object)
Adds an element with the provided key and value to the IDictionary object.
public void Add(object key, object value)
Parameters
key
objectThe object to use as the key of the element to add.
value
objectThe object to use as the value of the element to add.
Clear()
Removes all elements from the IDictionary object.
public void Clear()
Contains(object)
Determines whether the IDictionary object contains an element with the specified key.
public bool Contains(object key)
Parameters
key
objectThe key to locate in the IDictionary object.
Returns
- bool
true if the IDictionary contains an element with the key; otherwise, false.
CopyTo(Array, int)
Copies the elements of the ICollection to an Array, starting at a particular Array index.
public void CopyTo(Array array, int index)
Parameters
array
ArrayThe one-dimensional Array that is the destination of the elements copied from ICollection. The Array must have zero-based indexing.
index
intThe zero-based index in
array
at which copying begins.
GetEnumerator()
Gets the enumerator.
public IDictionaryEnumerator GetEnumerator()
Returns
- IDictionaryEnumerator
The dictionary enumerator
Remove(object)
Removes the element with the specified key from the IDictionary object.
public void Remove(object key)
Parameters
key
objectThe key of the element to remove.