Returns a DataTable which defines the columns in this CSV file
Syntax
Visual Basic (Declaration) | |
---|
Public Function GetSchemaTable() As DataTable |
Example
Library/Library.Test/TestCsvReader.cs
C# | Copy Code |
---|
DataTable dt = new CsvReader(new StringReader(CSV_DOC1)).GetSchemaTable();
Assert.AreEqual(3, dt.Columns.Count);
Assert.AreEqual("f1", dt.Columns[0].ColumnName);
Assert.AreEqual(typeof(String), dt.Columns[0].DataType);
Assert.AreEqual("f2", dt.Columns[1].ColumnName);
Assert.AreEqual(typeof(String), dt.Columns[1].DataType);
Assert.AreEqual("f3", dt.Columns[2].ColumnName);
Assert.AreEqual(typeof(String), dt.Columns[2].DataType); |
VB.NET | Copy Code |
---|
Dim dt As DataTable = New CsvReader(New StringReader(CSV_DOC1)).GetSchemaTable()
Assert.AreEqual(3, dt.Columns.Count)
Assert.AreEqual("f1", dt.Columns(0).ColumnName)
Assert.AreEqual(GetType([String]), dt.Columns(0).DataType)
Assert.AreEqual("f2", dt.Columns(1).ColumnName)
Assert.AreEqual(GetType([String]), dt.Columns(1).DataType)
Assert.AreEqual("f3", dt.Columns(2).ColumnName)
Assert.AreEqual(GetType([String]), dt.Columns(2).DataType) |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also