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
ParameterInfoThe parameter being mapped.
Properties
ConstructorTypeMap
Gets or sets the map for a constructor type.
public virtual ClassMap? ConstructorTypeMap { get; set; }
Property Value
Data
Gets the parameter map data.
public virtual ParameterMapData Data { get; protected set; }
Property Value
ReferenceMap
Gets or sets the map for a reference type.
public virtual ParameterReferenceMap? ReferenceMap { get; set; }
Property Value
TypeConverterOption
Type converter options.
public virtual ParameterMapTypeConverterOption TypeConverterOption { get; protected set; }
Property Value
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
objectThe constant value.
Returns
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
objectThe default value.
Returns
Ignore()
Ignore the parameter when reading and writing.
public virtual ParameterMap Ignore()
Returns
Ignore(bool)
Ignore the parameter when reading and writing.
public virtual ParameterMap Ignore(bool ignore)
Parameters
ignore
boolTrue to ignore, otherwise false.
Returns
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
intThe index of the CSV field.
Returns
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
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
intThe index of the name.
Returns
Optional()
The field is optional.
public virtual ParameterMap Optional()
Returns
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
ITypeConverterThe TypeConverter to use.
Returns
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
Type Parameters
TConverter
The Type of the TypeConverter(ITypeConverter) to use.