开发者

Creating CSV file

开发者 https://www.devze.com 2023-01-29 17:39 出处:网络
using c#, open or reading a text file (source csv file) and . Finally, I have to create another csv file for these lines. Should I create a data table and insert each line after processing and finally

using c#, open or reading a text file (source csv file) and . Finally, I have to create another csv file for these lines. Should I create a data table and insert each line after processing and finally export the data table to a csv file. OR Create a csv file before starting foreach {} and w开发者_StackOverflowrite to this csv file for each line.

How would you do it?


The stream way is definitely the way to go!

Although a few years old now - I've used this csv reader framework LumenWorks.Framework.IO.Csv in a few projects and it has worked fine..

http://www.codeproject.com/KB/database/CsvReader.aspx


Depends on how big the orignal file is. In general, it helps scalability to stream like your 2nd option - to NOT load something completely into memeory if you don't really know how big it could be.

0

精彩评论

暂无评论...
验证码 换一张
取 消