CsvHelperAliases.

WriteCsv<T>(ICakeContext, FilePath, List<T>, Dictionary<string, string>, CsvHelperSettings) Method

Summary

Writes the records to the speficed file using the specified class mapp and settings.
Assembly
Cake.CsvHelper.dll
Namespace
Cake.CsvHelper
Containing Type
CsvHelperAliases

Syntax

public static void WriteCsv<T>(this ICakeContext context, FilePath csvFile, List<T> records, Dictionary<string, string> mapping, CsvHelperSettings settings)

Examples

var mapping = new Dictionary<string, string> { 
                                  {"Id", "EmployeeId"},
                                  {"Name", "FirstName"}
                              };
WriteCsv<Person>("./people.csv", new List<Person>(), mapping, new CsvHelperSettings { HasHeaderRecord = true });

Attributes

Type Description
CakeMethodAliasAttribute
CakeAliasCategoryAttribute

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.
mapping Dictionary<string, string> The property column mapping.
settings CsvHelperSettings The settings.

Return Value

Type Description
void List objects as defined by type.