Wintellect.PowerCollections Namespace
Algorithms Class
Algorithms Methods
GhostDoc Pro Sample Help File

Algorithms..::..GetDictionaryConverter<(Of <(<'TKey, TValue>)>)> Method (IDictionary<(Of <(<'TKey, TValue>)>)>, TValue)

Creates a delegate that converts keys to values by used a dictionary to map values. Keys that a not present in the dictionary are converted to a supplied default value.

Namespace:  Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax


public static Converter<TKey, TValue> GetDictionaryConverter<TKey, TValue>(
	IDictionary<TKey, TValue> dictionary,
	TValue defaultValue
)
Public Shared Function GetDictionaryConverter(Of TKey, TValue) ( _
	dictionary As IDictionary(Of TKey, TValue), _
	defaultValue As TValue _
) As Converter(Of TKey, TValue)
public:
generic<typename TKey, typename TValue>
static Converter<TKey, TValue>^ GetDictionaryConverter(
	IDictionary<TKey, TValue>^ dictionary, 
	TValue defaultValue
)

Type Parameters

TKey
TValue

Parameters

dictionary
Type: IDictionary<(Of <(<'TKey, TValue>)>)>
The dictionary used to perform the conversion.
defaultValue
Type: TValue
The result of the conversion for keys that are not present in the dictionary.

Return Value

A delegate to a method that converts keys to values.

Exceptions


ExceptionCondition
ArgumentNullExceptiondictionary is null.

Remarks


This delegate can be used as a parameter in Convert or ConvertAll methods to convert entire collections.