在 CsvHelper v7.1.1 中读取 "un-typed" 个 CSV 文件
Reading "un-typed" CSV files in CsvHelper v7.1.1
在 CsvHelper 2.16.3 中,我有以下代码
public static IEnumerable<IEnumerable<string>> GetAllRecords(TextReader reader)
{
List<IEnumerable<string>> records = new List<IEnumerable<string>>();
var csvConfiguration = new CsvConfiguration { HasHeaderRecord = false };
using (var csv = new CsvReader(reader, csvConfiguration))
{
while (csv.Read())
{
records.Add(csv.CurrentRecord);
}
}
return records;
}
我正在升级一些软件包,我发现 CsvReader.CurrentRecord
在某些时候已被弃用和删除。从 7.1.1 版开始重写它的最佳方法是什么?
很多东西都移到了上下文对象中。 csv.Context.Record
在 CsvHelper 2.16.3 中,我有以下代码
public static IEnumerable<IEnumerable<string>> GetAllRecords(TextReader reader)
{
List<IEnumerable<string>> records = new List<IEnumerable<string>>();
var csvConfiguration = new CsvConfiguration { HasHeaderRecord = false };
using (var csv = new CsvReader(reader, csvConfiguration))
{
while (csv.Read())
{
records.Add(csv.CurrentRecord);
}
}
return records;
}
我正在升级一些软件包,我发现 CsvReader.CurrentRecord
在某些时候已被弃用和删除。从 7.1.1 版开始重写它的最佳方法是什么?
很多东西都移到了上下文对象中。 csv.Context.Record