Table of Contents

Class TypeConverterCache

Namespace
CsvHelper.TypeConversion
Assembly
CsvHelper.dll

Caches ITypeConverters for a given type.

public class TypeConverterCache
Inheritance
TypeConverterCache
Inherited Members

Constructors

TypeConverterCache()

Initializes the TypeConverterCache class.

public TypeConverterCache()

Methods

AddConverter(ITypeConverter)

Adds the given ITypeConverter to all registered types.

public void AddConverter(ITypeConverter typeConverter)

Parameters

typeConverter ITypeConverter

The type converter.

AddConverter(Type, ITypeConverter)

Adds the ITypeConverter for the given Type.

public void AddConverter(Type type, ITypeConverter typeConverter)

Parameters

type Type

The type the converter converts.

typeConverter ITypeConverter

The type converter that converts the type.

AddConverterFactory(ITypeConverterFactory)

Adds the ITypeConverterFactory. Factories are queried in order of being added and first factory that handles the type is used for creating the ITypeConverter.

public void AddConverterFactory(ITypeConverterFactory typeConverterFactory)

Parameters

typeConverterFactory ITypeConverterFactory

Type converter factory

AddConverter<T>(ITypeConverter)

Adds the ITypeConverter for the given Type.

public void AddConverter<T>(ITypeConverter typeConverter)

Parameters

typeConverter ITypeConverter

The type converter that converts the type.

Type Parameters

T

The type the converter converts.

AddConverter<T>(TypeConverter<T>)

Adds the TypeConverter<T> for the given Type.

public void AddConverter<T>(TypeConverter<T> typeConverter)

Parameters

typeConverter TypeConverter<T>

The type converter that converts the type.

Type Parameters

T

The type the converter converts.

Contains(Type)

Determines if there is a converter registered for the given type.

public bool Contains(Type type)

Parameters

type Type

The type to check.

Returns

bool

true if the converter is registered, otherwise false.

GetConverter(MemberInfo)

Gets the converter for the given member. If an attribute is found on the member, that will be used, otherwise the cache will be used.

public ITypeConverter GetConverter(MemberInfo member)

Parameters

member MemberInfo

The member to get the converter for.

Returns

ITypeConverter

GetConverter(Type)

Gets the converter for the given Type.

public ITypeConverter GetConverter(Type type)

Parameters

type Type

The type to get the converter for.

Returns

ITypeConverter

The ITypeConverter for the given Type.

GetConverter<T>()

Gets the converter for the given Type.

public ITypeConverter GetConverter<T>()

Returns

ITypeConverter

The ITypeConverter for the given Type.

Type Parameters

T

The type to get the converter for.

RemoveConverter(Type)

Removes the ITypeConverter for the given Type.

public void RemoveConverter(Type type)

Parameters

type Type

The type to remove the converter for.

RemoveConverterFactory(ITypeConverterFactory)

Removes the ITypeConverterFactory.

public void RemoveConverterFactory(ITypeConverterFactory typeConverterFactory)

Parameters

typeConverterFactory ITypeConverterFactory

The ITypeConverterFactory to remove.

RemoveConverter<T>()

Removes the ITypeConverter for the given Type.

public void RemoveConverter<T>()

Type Parameters

T

The type to remove the converter for.