C#中是否有任何CSV读取器/写入程序库? [英] Are there any CSV readers/writer libraries in C#?
本文介绍了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.
阅读: / strong>
Reading:
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屋!
查看全文