Table of Contents

Class ConvertibleConverterDictionary

Namespace
Cuemon
Assembly
Cuemon.Kernel.dll

Represents a collection of converters that map IConvertible implementations to byte arrays.

public class ConvertibleConverterDictionary : IReadOnlyDictionary<Type, Func<IConvertible, byte[]>>, IReadOnlyCollection<KeyValuePair<Type, Func<IConvertible, byte[]>>>, IEnumerable<KeyValuePair<Type, Func<IConvertible, byte[]>>>, IEnumerable
Inheritance
ConvertibleConverterDictionary
Implements

Properties

Count

Gets the number of converters contained in this instance.

public int Count { get; }

Property Value

int

The number of registered converters.

this[Type]

Gets the converter associated with the specified type.

public Func<IConvertible, byte[]> this[Type type] { get; }

Parameters

type Type

The type whose associated converter to retrieve.

Property Value

Func<IConvertible, byte[]>

The converter associated with type, or null if no converter is registered for the specified type.

Keys

Gets the collection of types for which converters are registered.

public IEnumerable<Type> Keys { get; }

Property Value

IEnumerable<Type>

A collection that contains the registered converter types.

Values

Gets the collection of registered converters.

public IEnumerable<Func<IConvertible, byte[]>> Values { get; }

Property Value

IEnumerable<Func<IConvertible, byte[]>>

A collection that contains the registered converters.

Methods

Add(Type, Func<IConvertible, byte[]>)

Adds a converter for the specified type.

public ConvertibleConverterDictionary Add(Type type, Func<IConvertible, byte[]> converter)

Parameters

type Type

The type that implements IConvertible.

converter Func<IConvertible, byte[]>

The delegate that converts an IConvertible instance to a byte array.

Returns

ConvertibleConverterDictionary

This instance so that additional converters can be configured.

Exceptions

ArgumentNullException

type is null.

ArgumentOutOfRangeException

type does not implement IConvertible.

Add<T>(Func<T, byte[]>)

Adds a converter for the specified T.

public ConvertibleConverterDictionary Add<T>(Func<T, byte[]> converter) where T : IConvertible

Parameters

converter Func<T, byte[]>

The delegate that converts an instance of T to a byte array.

Returns

ConvertibleConverterDictionary

This instance so that additional converters can be configured.

Type Parameters

T

The type that implements IConvertible.

Exceptions

TypeArgumentOutOfRangeException

T does not implement IConvertible.

ContainsKey(Type)

Determines whether this dictionary contains a converter for the specified key.

public bool ContainsKey(Type key)

Parameters

key Type

The type to locate.

Returns

bool

true if this dictionary contains a converter for key; otherwise, false.

GetEnumerator()

Returns an enumerator that iterates through the registered converters.

public IEnumerator<KeyValuePair<Type, Func<IConvertible, byte[]>>> GetEnumerator()

Returns

IEnumerator<KeyValuePair<Type, Func<IConvertible, byte[]>>>

An enumerator that can be used to iterate through the registered converters.

TryGetValue(Type, out Func<IConvertible, byte[]>)

Gets the converter associated with the specified key.

public bool TryGetValue(Type key, out Func<IConvertible, byte[]> value)

Parameters

key Type

The type whose associated converter to retrieve.

value Func<IConvertible, byte[]>

When this method returns, contains the converter associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter.

Returns

bool

true if this dictionary contains a converter for key; otherwise, false.

Exceptions

ArgumentNullException

key is null.