MemberMap Class
Mapping info for a member to a CSV field.
Namespace
CsvHelper.Configuration
Base Types
  • object
Derived Types
graph BT Type-->Base0["object"] Type["MemberMap"] class Type type-node Derived0["MemberMap<TClass, TMember>"]-->Type click Derived0 "/CsvHelper/api/CsvHelper.Configuration/MemberMap_2"

Syntax

[DebuggerDisplay("Member = {Data.Member}, Names = {string.Join(\",\", Data.Names)}, Index = {Data.Index}, Ignore = {Data.Ignore}, Member = {Data.Member}, TypeConverter = {Data.TypeConverter}")]
public abstract class MemberMap

Attributes

Type Description
DebuggerDisplayAttribute

Properties

Name Property Type Summary
Data MemberMapData
Gets the member map data.
TypeConverterOption MemberMapTypeConverterOption
Type converter options.

Methods

Name Return Value Summary
Constant(object) MemberMap
The constant value that will be used for every record when reading and writing. This value will always be used no matter what other mapping configurations are specified.
CreateGeneric(Type, MemberInfo) MemberMap
Creates an instance of MemberMap using the given Type and MemberInfo.
static
Default(object, bool) MemberMap
The default value that will be used when reading when the CSV field is empty.
Ignore() MemberMap
Ignore the member when reading and writing. If this member has already been mapped as a reference member, either by a class map, or by automapping, calling this method will not ignore all the child members down the tree that have already been mapped.
Ignore(bool) MemberMap
Ignore the member when reading and writing. If this member has already been mapped as a reference member, either by a class map, or by automapping, calling this method will not ignore all the child members down the tree that have already been mapped.
Index(int, int) MemberMap
When reading, is used to get the field at the given index. When writing, the fields will be written in the order of the field indexes.
Name(string[]) MemberMap
When reading, is used to get the field at the index of the name if there was a header specified. It will look for the first name match in the order listed. When writing, sets the name of the field in the header record. The first name will be used.
NameIndex(int) MemberMap
When reading, is used to get the index of the name used when there are multiple names that are the same.
Optional() MemberMap
Ignore the member when reading if no matching field name can be found.
TypeConverter(ITypeConverter) MemberMap
Specifies the TypeConverter(ITypeConverter) to use when converting the member to and from a CSV field.
TypeConverter<TConverter>() MemberMap
Specifies the TypeConverter(ITypeConverter) to use when converting the member to and from a CSV field.
Validate(Validate, ValidateMessage) MemberMap
Specifies an expression to be used to validate a field when reading along with specified exception message.
Validate(Validate) MemberMap
Specifies an expression to be used to validate a field when reading.