C# 中是否有任何 CSV 读取器/写入器库? [英] Are there any CSV readers/writer libraries in C#?

查看:32
本文介绍了C# 中是否有任何 CSV 读取器/写入器库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 C# 中是否有任何 CSV 读取器/写入器库?

Are there any CSV readers/writer libraries in C#?

推荐答案

尝试 CsvHelper.它与 FastCsvReader 一样易于使用并且也可以编写.过去我对 FastCsvReader 很满意,但我也需要一些可以写作的东西,对 FileHelpers 不满意.

Try CsvHelper. It's as easy to use as FastCsvReader and does writing also. I've been very happy with FastCsvReader in the past, but I needed something that does writing also, and wasn't happy with FileHelpers.

阅读:

var csv = new CsvReader( stream );
var myCustomTypeList = csv.GetRecords<MyCustomType>();

写作:

var csv = new CsvWriter( stream );
csv.WriteRecords( myCustomTypeList );

完全披露:我是这个库的作者.

Full Disclosure: I am the author of this library.

这篇关于C# 中是否有任何 CSV 读取器/写入器库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆