public static void WriteCsv(
this DataTable dataTable,
CsvWriter writer,
CsvMapping mapping
)<ExtensionAttribute>
Public Shared Sub WriteCsv (
dataTable As DataTable,
writer As CsvWriter,
mapping As CsvMapping
)public:
[ExtensionAttribute]
static void WriteCsv(
DataTable^ dataTable,
CsvWriter^ writer,
CsvMapping^ mapping
)[<ExtensionAttribute>]
static member WriteCsv :
dataTable : DataTable *
writer : CsvWriter *
mapping : CsvMapping -> unit Each PropertyName of mapping MUST have a corresponding DataColumn in dataTable - corresponding in the Caption property (case-insensitive) and the accepted data type.
Effort must be taken that the PropertyNames in mapping are unique, even when treated case-insensitive.
The DynamicProperty instances in mapping don't need to match all columns of the DataTable or all columns of the CSV file (neither in number nor in order).
| ArgumentNullException | dataTable, or writer, or mapping is null. |
| ArgumentException | There is a DynamicProperty in mapping whose PropertyName finds no corresponding ColumnName in dataTable. |
| InvalidCastException | A value in dataTable does not match the expected data type in mapping. |
| FormatException | One of the TypeConverterT instances uses an invalid format string. |
| IOException | I/O error. |
| ObjectDisposedException | The file was already closed. |