我正在使用CsvHelper,但我希望能够序列化字段而不仅仅是属性。有没有办法做到这一点?
请注意,这很难搜索,因为文档使用单词“Field”来表示类属性,但我在谈论一个实际的类字段,即此类中的MyIntField
:
class Something
{
public int MyIntProperty {get; set;}
public int MyIntField;
}
答案 0 :(得分:3)
不,目前无法实现。您收到错误消息
'MyIntField' is not a property. Did you try to map a field by accident?