Class AbstractErrorHandledNamedValues<T>
Dictionary of NamedValues<T> that provides abstracts method to handle errors.
public abstract class AbstractErrorHandledNamedValues<T> : IDictionary<string, T>, ICollection<KeyValuePair<string, T>>, IReadOnlyDictionary<string, T>, IReadOnlyCollection<KeyValuePair<string, T>>, IEnumerable<KeyValuePair<string, T>>, IEnumerable
Type Parameters
T
Type parameter for the contained named values
- Inheritance
-
AbstractErrorHandledNamedValues<T>
- Implements
-
IDictionary<string, T>
- Derived
- Inherited Members
- Extension Methods
Constructors
AbstractErrorHandledNamedValues()
Default ctor
public AbstractErrorHandledNamedValues()
AbstractErrorHandledNamedValues(IEnumerable<KeyValuePair<string, T>>)
Ctor to intialize from another properties dictionary.
public AbstractErrorHandledNamedValues(IEnumerable<KeyValuePair<string, T>> other)
Parameters
other
IEnumerable<KeyValuePair<string, T>>
AbstractErrorHandledNamedValues(int)
Ctor from capacity
public AbstractErrorHandledNamedValues(int capacity)
Parameters
capacity
int
Properties
Count
public int Count { get; }
Property Value
IsReadOnly
public bool IsReadOnly { get; }
Property Value
this[string]
public T this[string key] { get; set; }
Parameters
key
string
Property Value
- T
Keys
public ICollection<string> Keys { get; }
Property Value
Values
public ICollection<T> Values { get; }
Property Value
- ICollection<T>
Methods
Add(string, T)
public void Add(string key, T value)
Parameters
key
stringvalue
T
AsReadonly()
Retuns a read-only version of this dctionary.
public IReadOnlyDictionary<string, T> AsReadonly()
Returns
Clear()
public void Clear()
Contains(KeyValuePair<string, T>)
public bool Contains(KeyValuePair<string, T> item)
Parameters
item
KeyValuePair<string, T>
Returns
ContainsKey(string)
public bool ContainsKey(string key)
Parameters
key
string
Returns
CopyTo(KeyValuePair<string, T>[], int)
public void CopyTo(KeyValuePair<string, T>[] array, int arrayIndex)
Parameters
array
KeyValuePair<string, T>[]arrayIndex
int
GetEnumerator()
public IEnumerator<KeyValuePair<string, T>> GetEnumerator()
Returns
HandleDuplicateKey(string, T)
Error handler method called on an attempt to add a duplicate key.
protected abstract void HandleDuplicateKey(string key, T newValue)
Parameters
key
stringnewValue
T
Remarks
Implementation could set the newValue
to the existing key or even throw their own exception.
HandleKeyNotFound(string)
Error handler method called on key-not-found errors.
protected abstract T HandleKeyNotFound(string key)
Parameters
key
string
Returns
- T
Remarks
Implementation could return a special value or even throw their own exception.
Remove(KeyValuePair<string, T>)
public bool Remove(KeyValuePair<string, T> item)
Parameters
item
KeyValuePair<string, T>
Returns
Remove(string)
public bool Remove(string key)
Parameters
key
string
Returns
TryGetValue(string, out T)
public bool TryGetValue(string key, out T value)
Parameters
key
stringvalue
T
Returns
Explicit Interface Implementations
ICollection<KeyValuePair<string, T>>.Add(KeyValuePair<string, T>)
void ICollection<KeyValuePair<string, T>>.Add(KeyValuePair<string, T> item)
Parameters
item
KeyValuePair<string, T>
IReadOnlyDictionary<string, T>.Keys
IEnumerable<string> IReadOnlyDictionary<string, T>.Keys { get; }
Returns
IReadOnlyDictionary<string, T>.Values
IEnumerable<T> IReadOnlyDictionary<string, T>.Values { get; }
Returns
- IEnumerable<T>
IEnumerable.GetEnumerator()
IEnumerator IEnumerable.GetEnumerator()