CsvHelper icon indicating copy to clipboard operation
CsvHelper copied to clipboard

can't write csv

Open daizhikai opened this issue 13 years ago • 3 comments

hi,3ks 4 your code. but it can't wirte csv,and i try add “writer.Flush();” in method “NextRecord()",than it works. please check it out. thank u again!

daizhikai avatar Jul 12 '13 01:07 daizhikai

using( var stream = File.OpenWrite( "my location" ) )
using( var writer = new StreamWriter( stream ) )
using( var csv = CsvWriter( writer ) )
{
    var myRecords = new List<MyRecord>();
    // Fill myRecords with your data
    csv.WriteRecords( myRecords );
}

JoshClose avatar Jul 12 '13 01:07 JoshClose

yeah! everything is ok. i use memorystream and than use streamWriter.Flush() in my code, it works. but the examples in CsvHelper.Example project has a little problem, all write methos does not work.

thanks!

daizhikai avatar Jul 12 '13 02:07 daizhikai

I should really delete that example project. It wasn't meant for other people to use and was created before I put this code on github.

JoshClose avatar Jul 12 '13 02:07 JoshClose