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
typeConverterITypeConverterThe type converter.
AddConverter(Type, ITypeConverter)
Adds the ITypeConverter for the given Type.
public void AddConverter(Type type, ITypeConverter typeConverter)
Parameters
typeTypeThe type the converter converts.
typeConverterITypeConverterThe 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
typeConverterFactoryITypeConverterFactoryType converter factory
AddConverter<T>(ITypeConverter)
Adds the ITypeConverter for the given Type.
public void AddConverter<T>(ITypeConverter typeConverter)
Parameters
typeConverterITypeConverterThe type converter that converts the type.
Type Parameters
TThe type the converter converts.
AddConverter<T>(TypeConverter<T>)
Adds the TypeConverter<T> for the given Type.
public void AddConverter<T>(TypeConverter<T> typeConverter)
Parameters
typeConverterTypeConverter<T>The type converter that converts the type.
Type Parameters
TThe type the converter converts.
Contains(Type)
Determines if there is a converter registered for the given type.
public bool Contains(Type type)
Parameters
typeTypeThe type to check.
Returns
- bool
trueif 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
memberMemberInfoThe member to get the converter for.
Returns
GetConverter(Type)
Gets the converter for the given Type.
public ITypeConverter GetConverter(Type type)
Parameters
typeTypeThe 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
TThe type to get the converter for.
RemoveConverter(Type)
Removes the ITypeConverter for the given Type.
public void RemoveConverter(Type type)
Parameters
typeTypeThe type to remove the converter for.
RemoveConverterFactory(ITypeConverterFactory)
Removes the ITypeConverterFactory.
public void RemoveConverterFactory(ITypeConverterFactory typeConverterFactory)
Parameters
typeConverterFactoryITypeConverterFactoryThe ITypeConverterFactory to remove.
RemoveConverter<T>()
Removes the ITypeConverter for the given Type.
public void RemoveConverter<T>()
Type Parameters
TThe type to remove the converter for.