Interface ISunamoDictionary<T, U>
- Namespace
- SunamoInterfaces.Interfaces
- Assembly
- SunamoInterfaces.dll
Interface for custom dictionary implementation.
public interface ISunamoDictionary<T, U>
Type Parameters
TThe type of keys in the dictionary.
UThe type of values in the dictionary.
- Extension Methods
Properties
Count
Gets the number of key/value pairs contained in the dictionary.
int Count { get; }
Property Value
IsReadOnly
Gets a value indicating whether the dictionary is read-only.
bool IsReadOnly { get; }
Property Value
this[T]
Gets or sets the value associated with the specified key.
U this[T key] { get; set; }
Parameters
keyTThe key of the value to get or set.
Property Value
- U
The value associated with the specified key.
Keys
Gets a collection containing the keys.
ICollection<T> Keys { get; }
Property Value
- ICollection<T>
Values
Gets a collection containing the values.
ICollection<U> Values { get; }
Property Value
- ICollection<U>
Methods
Add(KeyValuePair<T, U>)
Adds the specified key/value pair to the dictionary.
void Add(KeyValuePair<T, U> pair)
Parameters
pairKeyValuePair<T, U>The key/value pair to add.
Add(T, U)
Adds the specified key and value to the dictionary.
void Add(T key, U value)
Parameters
keyTThe key of the element to add.
valueUThe value of the element to add.
Clear()
Removes all keys and values from the dictionary.
void Clear()
Contains(KeyValuePair<T, U>)
Determines whether the dictionary contains the specified key/value pair.
bool Contains(KeyValuePair<T, U> pair)
Parameters
pairKeyValuePair<T, U>The key/value pair to locate.
Returns
- bool
True if found; otherwise, false.
ContainsKey(T)
Determines whether the dictionary contains the specified key.
bool ContainsKey(T key)
Parameters
keyTThe key to locate.
Returns
- bool
True if the key exists; otherwise, false.
CopyTo(KeyValuePair<T, U>[], int)
Copies the elements of the dictionary to an array, starting at the specified array index.
void CopyTo(KeyValuePair<T, U>[] array, int arrayIndex)
Parameters
arrayKeyValuePair<T, U>[]The destination array.
arrayIndexintThe zero-based index in array at which copying begins.
GetEnumerator()
Returns an enumerator that iterates through the dictionary.
IEnumerator<KeyValuePair<T, U>> GetEnumerator()
Returns
- IEnumerator<KeyValuePair<T, U>>
An enumerator for the dictionary.
Remove(KeyValuePair<T, U>)
Removes the specified key/value pair from the dictionary.
bool Remove(KeyValuePair<T, U> pair)
Parameters
pairKeyValuePair<T, U>The key/value pair to remove.
Returns
- bool
True if the pair was removed; otherwise, false.
Remove(T)
Removes the value with the specified key from the dictionary.
bool Remove(T key)
Parameters
keyTThe key of the element to remove.
Returns
- bool
True if the element was removed; otherwise, false.
TryGetValue(T, out U)
Gets the value associated with the specified key.
bool TryGetValue(T key, out U value)
Parameters
keyTThe key of the value to get.
valueUWhen this method returns, contains the value associated with the specified key, if the key is found.
Returns
- bool
True if the key was found; otherwise, false.