CsvHelper
CsvHelper copied to clipboard
[Feature request] Anonymous type and dictionary support
Hi, there is a cool idea that you can borrow from MiniExcel
1. Anonymous type support
csv.WriteRecords(new[] {
new { Column1 = "MiniExcel", Column2 = 1 },
new { Column1 = "Github", Column2 = 2}
});
2. Dictionary support
var values = new List<Dictionary<string, object>>()
{
new Dictionary<string,object>{{ "Column1", "MiniExcel" }, { "Column2", 1 } },
new Dictionary<string,object>{{ "Column1", "Github" }, { "Column2", 2 } }
};
csv.WriteRecords(values);
Source sample data:
Column1 | Column2 |
---|---|
MiniExcel | 1 |
Github | 2 |