CsvRecordMapAttribute(Type)
public CsvRecordMapAttribute(Type recordType)Maps recordType with the attributes of this class's members.
Parameters
recordTypeType- The type whose records are read and written.
Attribute in CsvHelper
Maps a type that you cannot annotate, such as a type of another library or generated code: on a partial class, makes the source generator write the mapper and record writer of RecordType as if it were a CsvRecordAttribute type, with the attributes that the members of this class carry.
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public sealed class CsvRecordMapAttribute : AttributeCsvHelperCsvHelper.dllEach property or field of the map class stands in for the member of RecordType with the same name, and must have the same type; it only carries attributes (CsvColumnAttribute, CsvIgnoreAttribute, CsvFormatAttribute and the others), and the map class is never created. Members of the record type without a stand-in are mapped as usual, and so are the parameters of its constructor, which take the attributes of the stand-in with their name. Attributes of the record type itself, such as CsvOptionsAttribute and CsvIgnoreBaseAttribute, go on the map class, and so do the methods of CsvValidateAttribute.
The generated code uses only what the map class can access: the public (or, in the same assembly, internal) members and constructors of the record type. CsvReader.GetRecords and the other record methods find the mapper of the record type as they find those of CsvRecordAttribute types. A mapped type cannot be a nested record of another record type.
public CsvRecordMapAttribute(Type recordType)Maps recordType with the attributes of this class's members.
recordTypeTypepublic Type RecordType { get; }The type whose records are read and written.