csvhelper - 在 CsvHelper v7.1.1 中读取“未键入”的 CSV 文件
问题描述
在 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
推荐阅读
- android - 在我的颤振应用程序中添加广告后,当互联网关闭时,我的应用程序在初始化时崩溃
- spring-cloud-stream - 为 StreamBridge 输出绑定生成的 SubscribableChannel 始终将 unknown.channel.name 作为它们的 fullChannelName
- python - 如何正确关闭已打开的订单?(下单时不能将票号传递给“仓位”)
- jquery - 标签输入:当它是 2 个空格而不是 1 个空格时更改标签
- python - 如何在熊猫的特定位置添加列?
- sql-server - 通过 odbc 驱动程序将其连接到雪花后,ssis 未显示雪花中存在的所有模式或表
- java - 创建了一个类来打印一组通用对象,但我没有得到任何输出?
- python-3.x - PermissionError: [WinError 32] 该进程无法访问该文件,因为在尝试重命名文件时它正被另一个进程使用
- flutter - Flutter MaterialPageRoute 在发布模式下不起作用
- css - React styled-components 共享样式