Writes the DataTable to a CSV file using the specified file name.

Namespace: System.Extensions.Data
Assembly: System.Extensions (in System.Extensions.dll) Version: 0.0.0.5 (0.0.0.5)

Syntax

C#
public static void WriteCsv(
	this DataTable table,
	string fileName,
	bool hasHeader
)
Visual Basic
<ExtensionAttribute> 
Public Shared Sub WriteCsv ( 
	table As DataTable,
	fileName As String,
	hasHeader As Boolean
)
Visual C++
public:
[ExtensionAttribute]
static void WriteCsv(
	DataTable^ table, 
	String^ fileName, 
	bool hasHeader
)
F#
static member WriteCsv : 
        table : DataTable * 
        fileName : string * 
        hasHeader : bool -> unit 

Parameters

table
Type: System.Data..::..DataTable
The table that contains the data to write.
fileName
Type: System..::..String
The name of the file where the data should be written.
hasHeader
Type: System..::..Boolean
Whether the CSV document should have a header row.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DataTable. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also