CSharpTest.Net
CsvReader Constructor(TextReader)
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Data Namespace > CsvReader Class > CsvReader Constructor : CsvReader Constructor(TextReader)

reader
The text reader to read from

Glossary Item Box

Constructs the CSV reader for the provided text reader

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal reader As TextReader _
)
C# 
public CsvReader( 
   TextReader reader
)

Parameters

reader
The text reader to read from

Example

Library/Library.Test/TestCsvReader.cs

C#Copy Code
using (CsvReader r = new CsvReader(new StringReader(CSV_DOC1)))
{
    r.Read();
    Assert.AreEqual("1a", r["f1"]);
    Assert.AreEqual("1b", r[1]);
    Assert.AreEqual("1c", r.GetString(2));
    Assert.AreEqual("1c", r.GetValues()[2]);
}
VB.NETCopy Code
Using r As New CsvReader(New StringReader(CSV_DOC1))
    r.Read()
    Assert.AreEqual("1a", r("f1"))
    Assert.AreEqual("1b", r(1))
    Assert.AreEqual("1c", r.GetString(2))
    Assert.AreEqual("1c", r.GetValues()(2))
End Using

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys