Parameters
- i
Library/Library.Test/TestCsvReader.cs
C# | Copy Code |
---|---|
using (CsvReader r = new CsvReader(new StringReader(CSV_DOC1))) { Assert.AreEqual(3, r.FieldCount); for (int i = 0; i < r.FieldCount; i++) { Assert.AreEqual(typeof(String), r.GetFieldType(i)); Assert.AreEqual(typeof(String).Name, ((IDataReader)r).GetDataTypeName(i)); Assert.AreEqual("f" + (i + 1).ToString(), r.GetName(i).ToString()); Assert.AreEqual(i, r.GetOrdinal("f" + (i + 1).ToString())); } while (r.Read()) { } Assert.IsFalse(r.IsClosed); Assert.IsFalse(((IDataReader)r).NextResult()); Assert.IsTrue(r.IsClosed); } |
VB.NET | Copy Code |
---|---|
Using r As New CsvReader(New StringReader(CSV_DOC1)) Assert.AreEqual(3, r.FieldCount) Dim i As Integer = 0 While i < r.FieldCount Assert.AreEqual(GetType([String]), r.GetFieldType(i)) Assert.AreEqual(GetType([String]).Name, (DirectCast(r, IDataReader)).GetDataTypeName(i)) Assert.AreEqual("f" + (i + 1).ToString(), r.GetName(i).ToString()) Assert.AreEqual(i, r.GetOrdinal("f" + (i + 1).ToString())) System.Math.Max(System.Threading.Interlocked.Increment(i),i - 1) End While While r.Read() End While Assert.IsFalse(r.IsClosed) Assert.IsFalse((DirectCast(r, IDataReader)).NextResult()) Assert.IsTrue(r.IsClosed) End Using |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
CsvReader ClassCsvReader Members