CsvHelper wrap all values with quotes

后端 未结 2 1693
青春惊慌失措
青春惊慌失措 2021-01-11 15:31

I am using CsvHelper I need to wrap all values with quotes. Is that possible?

Data = is a List

 using (StreamWriter textWriter = new StreamWriter(pat         


        
2条回答
  •  天涯浪人
    2021-01-11 15:50

    Just need to add a configuration object. like this

    CsvHelper.Configuration.CsvConfiguration config = new CsvHelper.Configuration.CsvConfiguration();
                   config.QuoteAllFields = true;
                    var csv = new CsvWriter(textWriter, config);
    

提交回复
热议问题