Table of Contents

Class ParameterMap

Namespace
CsvHelper.Configuration
Assembly
CsvHelper.dll

Mapping for a constructor parameter. This may contain value type data, a constructor type map, or a reference map, depending on the type of the parameter.

public class ParameterMap
Inheritance
ParameterMap
Inherited Members

Constructors

ParameterMap(ParameterInfo)

Creates an instance of ParameterMap using the given information.

public ParameterMap(ParameterInfo parameter)

Parameters

parameter ParameterInfo

The parameter being mapped.

Properties

ConstructorTypeMap

Gets or sets the map for a constructor type.

public virtual ClassMap? ConstructorTypeMap { get; set; }

Property Value

ClassMap

Data

Gets the parameter map data.

public virtual ParameterMapData Data { get; protected set; }

Property Value

ParameterMapData

ReferenceMap

Gets or sets the map for a reference type.

public virtual ParameterReferenceMap? ReferenceMap { get; set; }

Property Value

ParameterReferenceMap

TypeConverterOption

Type converter options.

public virtual ParameterMapTypeConverterOption TypeConverterOption { get; protected set; }

Property Value

ParameterMapTypeConverterOption

Methods

Constant(object)

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.

public virtual ParameterMap Constant(object constantValue)

Parameters

constantValue object

The constant value.

Returns

ParameterMap

Default(object)

The default value that will be used when reading when the CSV field is empty.

public virtual ParameterMap Default(object defaultValue)

Parameters

defaultValue object

The default value.

Returns

ParameterMap

Ignore()

Ignore the parameter when reading and writing.

public virtual ParameterMap Ignore()

Returns

ParameterMap

Ignore(bool)

Ignore the parameter when reading and writing.

public virtual ParameterMap Ignore(bool ignore)

Parameters

ignore bool

True to ignore, otherwise false.

Returns

ParameterMap

Index(int)

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.

public virtual ParameterMap Index(int index)

Parameters

index int

The index of the CSV field.

Returns

ParameterMap

Name(params string[])

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.

public virtual ParameterMap Name(params string[] names)

Parameters

names string[]

The possible names of the CSV field.

Returns

ParameterMap

NameIndex(int)

When reading, is used to get the index of the name used when there are multiple names that are the same.

public virtual ParameterMap NameIndex(int index)

Parameters

index int

The index of the name.

Returns

ParameterMap

Optional()

The field is optional.

public virtual ParameterMap Optional()

Returns

ParameterMap

TypeConverter(ITypeConverter)

Specifies the TypeConverter(ITypeConverter) to use when converting the parameter to and from a CSV field.

public virtual ParameterMap TypeConverter(ITypeConverter typeConverter)

Parameters

typeConverter ITypeConverter

The TypeConverter to use.

Returns

ParameterMap

TypeConverter<TConverter>()

Specifies the TypeConverter(ITypeConverter) to use when converting the parameter to and from a CSV field.

public virtual ParameterMap TypeConverter<TConverter>() where TConverter : ITypeConverter

Returns

ParameterMap

Type Parameters

TConverter

The Type of the TypeConverter(ITypeConverter) to use.