Returns the current record number of the parser
Syntax
Visual Basic (Declaration) | |
---|
Public ReadOnly Property RecordsAffected As Integer |
C# | |
---|
public int RecordsAffected {get;} |
Example
Library/Library.Test/TestCsvReader.cs
C# | Copy Code |
---|
using (TempFile temp = new TempFile())
{
File.WriteAllText(temp.TempPath, CSV_DOC1);
using (CsvReader r = new CsvReader(temp.TempPath))
{
Assert.AreEqual(3, r.FieldCount);
int row = 0;
while (r.Read())
{
for (int col = 0; col < 3; col++)
{
Assert.AreEqual(CSV_DOC1_VAL[row, col], r.GetString(col));
}
row++;
}
Assert.AreEqual(5, row);
Assert.AreEqual(5, r.RecordsAffected);
}
} |
VB.NET | Copy Code |
---|
Using temp As New TempFile()
File.WriteAllText(temp.TempPath, CSV_DOC1)
Using r As New CsvReader(temp.TempPath)
Assert.AreEqual(3, r.FieldCount)
Dim row As Integer = 0
While r.Read()
Dim col As Integer = 0
While col < 3
Assert.AreEqual(CSV_DOC1_VAL(row, col), r.GetString(col))
System.Math.Max(System.Threading.Interlocked.Increment(col),col - 1)
End While
System.Math.Max(System.Threading.Interlocked.Increment(row),row - 1)
End While
Assert.AreEqual(5, row)
Assert.AreEqual(5, r.RecordsAffected)
End Using
End Using |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also