Answers for "c# csvhelper"

C#
0

c# csvhelper

void Main()
{
    var records = new List<dynamic>();
    
    dynamic record = new ExpandoObject();
    record.Id = 1;
    record.Name = "one";
    records.Add(record);
    
    using (var writer = new StringWriter())
    using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
    {
        csv.WriteRecords(records);
        
        writer.ToString().Dump();
    }
}
Posted by: Guest on April-08-2021
0

csharp csvhelper

using (TextWriter writer = new StreamWriter(@"C:\test.csv", false, System.Text.Encoding.UTF8))
{
    var csv = new CsvWriter(writer);
    csv.WriteRecords(values); // where values implements IEnumerable
}
Posted by: Guest on February-05-2021

C# Answers by Framework

Browse Popular Code Answers by Language