本文整理汇总了C#中FileHelperAsyncEngine.ReadNexts方法的典型用法代码示例。如果您正苦于以下问题:C# FileHelperAsyncEngine.ReadNexts方法的具体用法?C# FileHelperAsyncEngine.ReadNexts怎么用?C# FileHelperAsyncEngine.ReadNexts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileHelperAsyncEngine
的用法示例。
在下文中一共展示了FileHelperAsyncEngine.ReadNexts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteNullAsync
public void WriteNullAsync()
{
asyncEngine = new FileHelperAsyncEngine(typeof (SampleType));
asyncEngine.BeginWriteFile("tempNull.txt");
asyncEngine.WriteNext(new SampleType());
asyncEngine.WriteNext(new SampleType());
asyncEngine.WriteNext(new SampleType());
asyncEngine.Close();
asyncEngine.BeginReadFile("tempNull.txt");
SampleType[] res = (SampleType[]) asyncEngine.ReadNexts(5000);
asyncEngine.Close();
Assert.AreEqual(3, res.Length);
Assert.AreEqual(3, asyncEngine.TotalRecords);
Assert.AreEqual(0, asyncEngine.ErrorManager.ErrorCount);
Assert.AreEqual(DateTime.MinValue, res[0].Field1);
Assert.AreEqual("", res[0].Field2);
Assert.AreEqual(0, res[0].Field3);
if (File.Exists("tempNull.txt")) File.Delete("tempNull.txt");
}
示例2: ChangeLineInEvent
public void ChangeLineInEvent()
{
string input = "\n\n\n";
engine = new FileHelperAsyncEngine<SampleType>();
engine.BeforeReadRecord += new BeforeReadHandler<SampleType>(BeforeEventChange);
engine.BeginReadString(input);
SampleType[] res = (SampleType[]) engine.ReadNexts(3);
Assert.AreEqual(3, res.Length);
Assert.AreEqual(new DateTime(1314, 12, 11), res[0].Field1);
Assert.AreEqual("901", res[0].Field2);
Assert.AreEqual(234, res[0].Field3);
Assert.AreEqual(new DateTime(1314, 12, 11), res[1].Field1);
Assert.AreEqual("901", res[2].Field2);
Assert.AreEqual(234, res[2].Field3);
}