Class CsvContext
- Namespace
- CsvHelper
- Assembly
- CsvHelper.dll
Share state for CsvHelper.
public class CsvContext
- Inheritance
-
CsvContext
- Inherited Members
Constructors
CsvContext(CsvConfiguration)
Initializes a new instance of the CsvContext class.
public CsvContext(CsvConfiguration configuration)
Parameters
configuration
CsvConfigurationThe configuration.
CsvContext(IParser)
Initializes a new instance of the CsvContext class.
public CsvContext(IParser parser)
Parameters
parser
IParserThe parser.
CsvContext(IReader)
Initializes a new instance of the CsvContext class.
public CsvContext(IReader reader)
Parameters
reader
IReaderThe reader.
CsvContext(IWriter)
Initializes a new instance of the CsvContext class.
public CsvContext(IWriter writer)
Parameters
writer
IWriterThe writer.
Properties
Configuration
Gets the configuration.
public CsvConfiguration Configuration { get; }
Property Value
Maps
The configured ClassMaps.
public virtual ClassMapCollection Maps { get; }
Property Value
Parser
Gets the parser.
public IParser? Parser { get; }
Property Value
Reader
Gets the reader.
public IReader? Reader { get; }
Property Value
TypeConverterCache
Gets or sets the TypeConverterOptionsCache.
public virtual TypeConverterCache TypeConverterCache { get; set; }
Property Value
TypeConverterOptionsCache
Gets or sets the TypeConverterOptionsCache.
public virtual TypeConverterOptionsCache TypeConverterOptionsCache { get; set; }
Property Value
Writer
Gets the writer.
public IWriter? Writer { get; }
Property Value
Methods
AutoMap(Type)
Generates a ClassMap for the type.
public virtual ClassMap AutoMap(Type type)
Parameters
type
TypeThe type to generate for the map.
Returns
- ClassMap
The generate map.
AutoMap<T>()
Generates a ClassMap for the type.
public virtual ClassMap<T> AutoMap<T>()
Returns
- ClassMap<T>
The generate map.
Type Parameters
T
The type to generate the map for.
RegisterClassMap(ClassMap)
Registers the class map.
public virtual void RegisterClassMap(ClassMap map)
Parameters
map
ClassMapThe class map to register.
RegisterClassMap(Type)
Use a ClassMap<TClass> to configure mappings. When using a class map, no members are mapped by default. Only members specified in the mapping are used.
public virtual ClassMap RegisterClassMap(Type classMapType)
Parameters
classMapType
TypeThe type of mapping class to use.
Returns
RegisterClassMap<TMap>()
Use a ClassMap<TClass> to configure mappings. When using a class map, no members are mapped by default. Only member specified in the mapping are used.
public virtual TMap RegisterClassMap<TMap>() where TMap : ClassMap
Returns
- TMap
Type Parameters
TMap
The type of mapping class to use.
UnregisterClassMap()
Unregisters all class maps.
public virtual void UnregisterClassMap()
UnregisterClassMap(Type)
Unregisters the class map.
public virtual void UnregisterClassMap(Type classMapType)
Parameters
classMapType
TypeThe map type to unregister.
UnregisterClassMap<TMap>()
Unregisters the class map.
public virtual void UnregisterClassMap<TMap>() where TMap : ClassMap
Type Parameters
TMap
The map type to unregister.