Standard extension methods for ITryGet<K, V>.
More...
Source file:
Standard extension methods for ITryGet<K, V>.
|
static Maybe< V > | TryGet< K, V > (this ITryGet< K, V > self, K key) |
| Returns the value at the specified key or index, wrapped in Maybe<V>. More...
|
|
static V | TryGet< K, V > (this ITryGet< K, V > self, K key, V defaultValue) |
| Returns the value at the specified key or index, or the specified default value if the key was not found. More...
|
|
◆ TryGet< K, V >() [1/2]
static Maybe<V> Loyc.Collections.TryGetExt.TryGet< K, V > |
( |
this ITryGet< K, V > |
self, |
|
|
K |
key |
|
) |
| |
|
inlinestatic |
Returns the value at the specified key or index, wrapped in Maybe<V>.
- Parameters
-
key | A lookup key that might be associated with a value in this object. If K is an integer, this value could be an index into a list. |
- Returns
- A value associated with the key, wrapped in Maybe<V> so that Maybe<V>.HasValue is false if lookup fails.
◆ TryGet< K, V >() [2/2]
static V Loyc.Collections.TryGetExt.TryGet< K, V > |
( |
this ITryGet< K, V > |
self, |
|
|
K |
key, |
|
|
V |
defaultValue |
|
) |
| |
|
inlinestatic |
Returns the value at the specified key or index, or the specified default value if the key was not found.
- Parameters
-
key | A lookup key that might be associated with a value in this object. If K is an integer, this value could be an index into a list. |
defaultValue | A value to return if lookup fails. |