This content is part of a third party extension that is not supported by the Cake project.
For more information about this extension see
Cake.CsvHelper.
Summary
Writes the records to the speficed file using the specified class mapp and settings.
Syntax
public static void WriteCsv<T>(this ICakeContext context, FilePath csvFile, List<T> records, ClassMap classMap, CsvHelperSettings settings)
Examples
public sealed class PersonMap : CsvClassMap<Person>
{
public PersonMap()
{
Map(m => m.Id);
Map(m => m.Name);
}
}
WriteCsv<Person>("./people.csv", new List<Person>(), PersonMap, new CsvHelperSettings { HasHeaderRecord = true });
Attributes
| Type |
Description |
| CakeMethodAliasAttribute |
|
| CakeAliasCategoryAttribute |
|
| CakeNamespaceImportAttribute |
|
Type Parameters
| Name |
Description |
| T |
The type. |
Parameters
| Name |
Type |
Description |
| context |
ICakeContext |
The context. |
| csvFile |
FilePath |
The CSV to file to write. |
| records |
List<T> |
The list objects you want to write to a csv. |
| classMap |
ClassMap |
The CSV Helper Class Map. |
| settings |
CsvHelperSettings |
The settings. |
Return Value
| Type |
Description |
| void |
List objects as defined by type. |