删除双引号内的逗号,然后删除双引号

Removing a comma within double quotes, then remove double quotes

我在解析 .csv 时遇到了使用 FileHelpers 创建分隔符字段的问题。我有一行数据在 LINQ 操作期间总是崩溃,类似于他们网站上的 filehelpers 示例。

错误出现在列有引号的地方,例如这一行:

数据 1、数据 2、"data3a, data3b"、数据 4

如何删除引号内的逗号,然后删除 data3a 和 data3b 的引号?

.csv 文件中的特定列有两个内容,但我想不出我应该为此使用哪些分隔符字段。

如果我不清楚或此问题已得到回答或下面的评论不是有目的的。

非常感谢。

编辑: class

的代码

行:2010,NON-HISPANIC BLACK,MALE,"NEPHRITIS, NEPHROTIC SYNDROME AND NEPHROSIS",70,1

//delimiters, ignore first row, separate with comma
[DelimitedRecord(",")]
[IgnoreFirst()]
public class CauseofDeathClass
{

    public int Year { get; set; }
    public string Ethnicity { get; set; }
    public string Sex { get; set; }
    public string Cause_of_Death { get; set; }
    public int Count { get; set; }
    public int Percent { get; set; }

}

使用 FieldQuoted 属性。有关不同的 QuoteMode 选项,请参阅 here

//delimiters, ignore first row, separate with comma
[DelimitedRecord(",")]
[IgnoreFirst()]
public class CauseofDeathClass
{    
    public int Year { get; set; }
    [FieldQuoted('"', QuoteMode.OptionalForBoth)]
    public string Ethnicity { get; set; }
    [FieldQuoted('"', QuoteMode.OptionalForBoth)]
    public string Sex { get; set; }
    [FieldQuoted('"', QuoteMode.OptionalForBoth)]
    public string Cause_of_Death { get; set; }
    public int Count { get; set; }
    public int Percent { get; set; }
}