当我定义逗号作为新文件的文件分隔符时,我刚刚注意到,当我在数据中放置逗号时,这个逗号将被放置在输出文件中,所以这是否意味着FileHelpers不会自动影响数据本身,或者?例如,我认为FileHelpers已经包含了内部引擎,可以自动“更正”这些东西。
发布于 2016-09-13 07:21:39
当字段包含分隔符时,必须添加FieldQuoted才能使库自动使用引号
http://www.filehelpers.net/docs/html/T_FileHelpers_FieldQuotedAttribute.htm
还要检查QuoteMode参数
http://www.filehelpers.net/docs/html/T_FileHelpers_QuoteMode.htm
[DelimitedRecord(",")]
public class Records
{
// It will always contains " on output and require it for read
[FieldQuoted(QuoteMode.AlwaysQuoted)]
public string Name;
// It will add " if the data cantains a , and will read with no quotes
[FieldQuoted(QuoteMode.OptionalForBoth)]
public string Track;
[FieldQuoted]
public string worldPrice;
} https://stackoverflow.com/questions/39458971
复制相似问题