开发者

How to pass 'n' arrays to a method in C# and print is CSV File

Imagine a CSV file, with the headers for the fields in the first row and values on t开发者_如何学Gohe next rows, all of the same size.

for example these would be headers

area,hotelnames,zipcode,state

and these the values

200,star,93117,CA
230,2Star,93116,CA

I need to make a common method which would accept the data and write it in the mentioned way to a CSV file. The values are passed as arrays and can contain data of any type.


If you want to generate CSV file then use a library that was written to do just that. Don't reinvent the wheel ;-)

Use FileHelpers library that Eddy suggested in the comments under your question.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜