Show / Hide Table of Contents

Class DictionaryToOpt

Facility for retrieving a value from a dictionary as an option.

Inheritance
Object
DictionaryToOpt
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: Hgk.Zero.Options.Linq
Assembly: Hgk.Zero.Options.dll
Syntax
public static class DictionaryToOpt

Methods

| Improve this Doc View Source

GetValueOpt<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 key in source, if it is found; otherwise, an empty option.

Type Parameters
Name Description
TKey

The type of the keys in source.

TValue

The type of the values in source.

Exceptions
Type Condition
ArgumentNullException

source or key is null.

| Improve this Doc View Source

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 key in source, if it is found; otherwise, an empty option.

Type Parameters
Name Description
TKey

The type of the keys in source.

TValue

The type of the values in source.

Exceptions
Type Condition
ArgumentNullException

source or key is null.

| Improve this Doc View Source

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 key in source, if it is found; otherwise, an empty option.

Type Parameters
Name Description
TKey

The type of the keys in source.

TValue

The type of the values in source.

Exceptions
Type Condition
ArgumentNullException

source or key is null.

| Improve this Doc View Source

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 key in source, if it is found; otherwise, an empty option.

Type Parameters
Name Description
TKey

The type of the keys in source.

TValue

The type of the values in source.

Exceptions
Type Condition
ArgumentNullException

source or key is null.

| Improve this Doc View Source

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 key in source, if it is found; otherwise, an empty option.

Type Parameters
Name Description
TKey

The type of the keys in source.

TValue

The type of the values in source.

Exceptions
Type Condition
ArgumentNullException

source or key is null.

| Improve this Doc View Source

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 key in source, if it is found; otherwise, an empty option.

Type Parameters
Name Description
TKey

The type of the keys in source.

TValue

The type of the values in source.

Exceptions
Type Condition
ArgumentNullException

source or key is null.

| Improve this Doc View Source

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 key in source, if it is found; otherwise, an empty option.

Type Parameters
Name Description
TKey

The type of the keys in source.

TValue

The type of the values in source.

Exceptions
Type Condition
ArgumentNullException

source or key is null.

| Improve this Doc View Source

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 key in source, if it is found; otherwise, an empty option.

Type Parameters
Name Description
TKey

The type of the keys in source.

TValue

The type of the values in source.

Exceptions
Type Condition
ArgumentNullException

source or key is null.

| Improve this Doc View Source

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 key in source, if it is found; otherwise, an empty option.

Type Parameters
Name Description
TKey

The type of the keys in source.

TValue

The type of the values in source.

Exceptions
Type Condition
ArgumentNullException

source or key is null.

| Improve this Doc View Source

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 key in source, if it is found; otherwise, an empty option.

Type Parameters
Name Description
TKey

The type of the keys in source.

TValue

The type of the values in source.

Exceptions
Type Condition
ArgumentNullException

source or key is null.

| Improve this Doc View Source

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 key in source, if it is found; otherwise, an empty option.

Type Parameters
Name Description
TKey

The type of the keys in source.

TValue

The type of the values in source.

Exceptions
Type Condition
ArgumentNullException

source or key is null.

  • Improve this Doc
  • View Source
Back to top Copyright © 2018-2019 Peter S. May
Generated by DocFX