CsvMapperCache Class
Definition
Namespace: DataStandardizer.File.CSV
The process-wide cache of the mappers that readers and writers build from CsvFieldMappingAttribute attributes on record line types, of the type converters those mappings name, and of the other details the package works out once per record line and property type, such as the field names of a record line’s properties.
Syntax
public static class CsvMapperCache
Remarks
A reader or writer builds the mapper for a record line type from its attributes the first time it reads or writes a line of that type, then caches it here for every other reader and writer to use. Each entry is worked out from a type alone, so clearing the cache never changes how a line is read or written: the next reader or writer to need an entry builds it again.
Mappers registered with CsvFileIoBase<TRecordLine>.RegisterMapper aren’t held here. Each reader or writer keeps its own.
Thread safety. All members are safe to call from several threads at once, including while readers and writers are in use.
Methods
| Method | Returns | Notes |
|---|---|---|
Clear() | void | Removes every cached entry. Use it to release the memory the entries hold, or the record line, property and type converter types they refer to, for example before unloading a collectible AssemblyLoadContext that defines them. A reader or writer that is already open keeps the mapper it has resolved, so dispose of your readers, writers and record lines of those types before you call it. |
Applies to
Targets netstandard1.1, netstandard2.0, netstandard2.1, and net10.0.