首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >FileHelpers不会影响数据

FileHelpers不会影响数据
EN

Stack Overflow用户
提问于 2016-09-13 05:20:21
回答 1查看 49关注 0票数 0

当我定义逗号作为新文件的文件分隔符时,我刚刚注意到,当我在数据中放置逗号时,这个逗号将被放置在输出文件中,所以这是否意味着FileHelpers不会自动影响数据本身,或者?例如,我认为FileHelpers已经包含了内部引擎,可以自动“更正”这些东西。

EN

回答 1

Stack Overflow用户

发布于 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

代码语言:javascript
复制
[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;
}   
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39458971

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档