Writing a CSV file in .net

前端 未结 11 1383
生来不讨喜
生来不讨喜 2020-11-27 18:59

I have a requirement to export a dataset as a CSV file.

I have spent a while searching for a set of rules to go by and realised there are quite a few rules and exce

11条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-27 19:20

    I know you said you found your answer, but I just wanted to give a vote for the LINQtoCSV library you mentioned. I've used it in a couple projects and it works really well for keeping your business code clean and not concerned with details / peculiarities of the file format.

    Maybe in your specific case it is not too difficult to write the exporter, but the nice thing about this library is that it is bidirectional. If you find yourself having to consume the CSV down the road it's not much extra code, and/or it gives you a consistent library to use on future projects.

提交回复
热议问题