Formatting Properties Using FileHelper

FileHelpers has an excellent date converter for fields:

[FieldConverter(ConverterKind.Date, "MM-dd-yyyy")] 
public DateTime MyDate;

FieldConverter does not work with properties. I have to deal with objects that use properties, so I was looking for something like this:

[PropertyConverter(ConverterKind.Date, "MM-dd-yyyy")] 
public DateTime MyDate { get; set; }

How to do this with properties?

+5
source share
1 answer

You cannot use converters with properties.

However, you can only create a data model for an import / export record that is not bound to a domain object. This data model may have fields instead of properties.

, , , , CustomerRecord, ( - Automapper ), , .

, , .

+4

All Articles