更改 ServiceStack.Text.CsvSerializer 中的 CSV 分隔符
Change CSV delimiter in ServiceStack.Text.CsvSerializer
如果可能,如何在使用 ServiceStack.Text.CsvSerializer 时将分隔符从逗号更改为分号?
您可以通过设置
来控制它
ServiceStack.Text.CsvConfig.ItemSeperatorString = ";";
来自version 3.9.14 Release Notes:
- CsvConfig.ItemSeperatorString - Enables configuration of the separator between items in a csv file (ie | or ; rather than ,)
- CsvConfig.ItemDelimiterString - Enables configuration of the delimiter for an item that needs to be escaped in a csv file (ie | rather than ")
- CsvConfig.RowSeparatorString - Enables configuration of the delimiter for a row of items in a csv file (ie | \r\n)
注意设置为thread static。 (还要注意拼写错误。)
如果可能,如何在使用 ServiceStack.Text.CsvSerializer 时将分隔符从逗号更改为分号?
您可以通过设置
来控制它 ServiceStack.Text.CsvConfig.ItemSeperatorString = ";";
来自version 3.9.14 Release Notes:
- CsvConfig.ItemSeperatorString - Enables configuration of the separator between items in a csv file (ie | or ; rather than ,)
- CsvConfig.ItemDelimiterString - Enables configuration of the delimiter for an item that needs to be escaped in a csv file (ie | rather than ")
- CsvConfig.RowSeparatorString - Enables configuration of the delimiter for a row of items in a csv file (ie | \r\n)
注意设置为thread static。 (还要注意拼写错误。)