Class DictionaryToOpt
Facility for retrieving a value from a dictionary as an option.
Inherited Members
Namespace: Hgk.Zero.Options.Linq
Assembly: Hgk.Zero.Options.dll
Syntax
public static class DictionaryToOpt
Methods
| Improve this Doc View SourceGetValueOpt<TKey, TValue>(ConcurrentDictionary<TKey, TValue>, TKey)
Gets the value associated with a specified key as an option.
Declaration
public static Opt<TValue> GetValueOpt<TKey, TValue>(this ConcurrentDictionary<TKey, TValue> source, TKey key)
Parameters
Type | Name | Description |
---|---|---|
ConcurrentDictionary<TKey, TValue> | source | A source dictionary. |
TKey | key | The key whose value to get. |
Returns
Type | Description |
---|---|
Opt<TValue> | An option containing the value associated with |
Type Parameters
Name | Description |
---|---|
TKey | The type of the keys in |
TValue | The type of the values in |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
GetValueOpt<TKey, TValue>(Dictionary<TKey, TValue>, TKey)
Gets the value associated with a specified key as an option.
Declaration
public static Opt<TValue> GetValueOpt<TKey, TValue>(this Dictionary<TKey, TValue> source, TKey key)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<TKey, TValue> | source | A source dictionary. |
TKey | key | The key whose value to get. |
Returns
Type | Description |
---|---|
Opt<TValue> | An option containing the value associated with |
Type Parameters
Name | Description |
---|---|
TKey | The type of the keys in |
TValue | The type of the values in |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
GetValueOpt<TKey, TValue>(IDictionary<TKey, TValue>, TKey)
Gets the value associated with a specified key as an option.
Declaration
public static Opt<TValue> GetValueOpt<TKey, TValue>(this IDictionary<TKey, TValue> source, TKey key)
Parameters
Type | Name | Description |
---|---|---|
IDictionary<TKey, TValue> | source | A source dictionary. |
TKey | key | The key whose value to get. |
Returns
Type | Description |
---|---|
Opt<TValue> | An option containing the value associated with |
Type Parameters
Name | Description |
---|---|
TKey | The type of the keys in |
TValue | The type of the values in |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
GetValueOpt<TKey, TValue>(IReadOnlyDictionary<TKey, TValue>, TKey)
Gets the value associated with a specified key as an option.
Declaration
public static Opt<TValue> GetValueOpt<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> source, TKey key)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyDictionary<TKey, TValue> | source | A source dictionary. |
TKey | key | The key whose value to get. |
Returns
Type | Description |
---|---|
Opt<TValue> | An option containing the value associated with |
Type Parameters
Name | Description |
---|---|
TKey | The type of the keys in |
TValue | The type of the values in |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
GetValueOpt<TKey, TValue>(SortedDictionary<TKey, TValue>, TKey)
Gets the value associated with a specified key as an option.
Declaration
public static Opt<TValue> GetValueOpt<TKey, TValue>(this SortedDictionary<TKey, TValue> source, TKey key)
Parameters
Type | Name | Description |
---|---|---|
SortedDictionary<TKey, TValue> | source | A source dictionary. |
TKey | key | The key whose value to get. |
Returns
Type | Description |
---|---|
Opt<TValue> | An option containing the value associated with |
Type Parameters
Name | Description |
---|---|
TKey | The type of the keys in |
TValue | The type of the values in |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
GetValueOpt<TKey, TValue>(SortedList<TKey, TValue>, TKey)
Gets the value associated with a specified key as an option.
Declaration
public static Opt<TValue> GetValueOpt<TKey, TValue>(this SortedList<TKey, TValue> source, TKey key)
Parameters
Type | Name | Description |
---|---|---|
SortedList<TKey, TValue> | source | A source dictionary. |
TKey | key | The key whose value to get. |
Returns
Type | Description |
---|---|
Opt<TValue> | An option containing the value associated with |
Type Parameters
Name | Description |
---|---|
TKey | The type of the keys in |
TValue | The type of the values in |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
GetValueOpt<TKey, TValue>(ImmutableDictionary<TKey, TValue>, TKey)
Gets the value associated with a specified key as an option.
Declaration
public static Opt<TValue> GetValueOpt<TKey, TValue>(this ImmutableDictionary<TKey, TValue> source, TKey key)
Parameters
Type | Name | Description |
---|---|---|
ImmutableDictionary<TKey, TValue> | source | A source dictionary. |
TKey | key | The key whose value to get. |
Returns
Type | Description |
---|---|
Opt<TValue> | An option containing the value associated with |
Type Parameters
Name | Description |
---|---|
TKey | The type of the keys in |
TValue | The type of the values in |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
GetValueOpt<TKey, TValue>(ImmutableDictionary<TKey, TValue>.Builder, TKey)
Gets the value associated with a specified key as an option.
Declaration
public static Opt<TValue> GetValueOpt<TKey, TValue>(this ImmutableDictionary<TKey, TValue>.Builder source, TKey key)
Parameters
Type | Name | Description |
---|---|---|
ImmutableDictionary.Builder<> | source | A source dictionary. |
TKey | key | The key whose value to get. |
Returns
Type | Description |
---|---|
Opt<TValue> | An option containing the value associated with |
Type Parameters
Name | Description |
---|---|
TKey | The type of the keys in |
TValue | The type of the values in |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
GetValueOpt<TKey, TValue>(ImmutableSortedDictionary<TKey, TValue>, TKey)
Gets the value associated with a specified key as an option.
Declaration
public static Opt<TValue> GetValueOpt<TKey, TValue>(this ImmutableSortedDictionary<TKey, TValue> source, TKey key)
Parameters
Type | Name | Description |
---|---|---|
ImmutableSortedDictionary<TKey, TValue> | source | A source dictionary. |
TKey | key | The key whose value to get. |
Returns
Type | Description |
---|---|
Opt<TValue> | An option containing the value associated with |
Type Parameters
Name | Description |
---|---|
TKey | The type of the keys in |
TValue | The type of the values in |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
GetValueOpt<TKey, TValue>(ImmutableSortedDictionary<TKey, TValue>.Builder, TKey)
Gets the value associated with a specified key as an option.
Declaration
public static Opt<TValue> GetValueOpt<TKey, TValue>(this ImmutableSortedDictionary<TKey, TValue>.Builder source, TKey key)
Parameters
Type | Name | Description |
---|---|---|
ImmutableSortedDictionary.Builder<> | source | A source dictionary. |
TKey | key | The key whose value to get. |
Returns
Type | Description |
---|---|
Opt<TValue> | An option containing the value associated with |
Type Parameters
Name | Description |
---|---|
TKey | The type of the keys in |
TValue | The type of the values in |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
GetValueOpt<TKey, TValue>(ReadOnlyDictionary<TKey, TValue>, TKey)
Gets the value associated with a specified key as an option.
Declaration
public static Opt<TValue> GetValueOpt<TKey, TValue>(this ReadOnlyDictionary<TKey, TValue> source, TKey key)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlyDictionary<TKey, TValue> | source | A source dictionary. |
TKey | key | The key whose value to get. |
Returns
Type | Description |
---|---|
Opt<TValue> | An option containing the value associated with |
Type Parameters
Name | Description |
---|---|
TKey | The type of the keys in |
TValue | The type of the values in |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|