Interface IReadOnlySymbolTable<TKey, TValue>
- Namespace
- AlgorithmsSW.SymbolTable
- Assembly
- AlgorithmsSW.dll
Defines methods for reading information of a generic symbol table.
public interface IReadOnlySymbolTable<TKey, TValue>
Type Parameters
TKey
The type of keys in the symbol table.
TValue
The type of values in the symbol table.
- Extension Methods
Properties
Comparer
IComparer<TKey> Comparer { get; }
Property Value
- IComparer<TKey>
Count
Gets the number of key/value pairs contained in the symbol table.
int Count { get; }
Property Value
IsEmpty
Gets a value indicating whether the symbol table is empty.
bool IsEmpty { get; }
Property Value
this[TKey]
Gets the value associated with the given key.
TValue this[TKey key] { get; }
Parameters
key
TKeyThe key whose value to get.
Property Value
- TValue
Exceptions
- KeyNotFoundException
the key is not present in the symbol table.
Keys
Gets an IEnumerable<T> containing the keys of the symbol table.
IEnumerable<TKey> Keys { get; }
Property Value
- IEnumerable<TKey>
Methods
ContainsKey(TKey)
Determines whether the symbol table contains a specific key.
bool ContainsKey(TKey key)
Parameters
key
TKeyThe key to locate in the symbol table.
Returns
- bool
true
if the symbol table contains an element with the specified key; otherwise,false
.
TryGetValue(TKey, out TValue)
Tries to get the value associated with the specified key from the symbol table.
bool TryGetValue(TKey key, out TValue value)
Parameters
key
TKeyThe key of the value to get.
value
TValueWhen 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
- bool
true
if the symbol table contains an element with the specified key; otherwise,false
.