本文整理汇总了C#中FileHelperAsyncEngine.BeginAppendToFile方法的典型用法代码示例。如果您正苦于以下问题:C# FileHelperAsyncEngine.BeginAppendToFile方法的具体用法?C# FileHelperAsyncEngine.BeginAppendToFile怎么用?C# FileHelperAsyncEngine.BeginAppendToFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileHelperAsyncEngine
的用法示例。
在下文中一共展示了FileHelperAsyncEngine.BeginAppendToFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FileNotFound3
public void FileNotFound3()
{
engine2 = new FileHelperAsyncEngine(typeof (SampleType));
engine2.BeginAppendToFile(null);
}
示例2: AppendToEmptyAsync
public void AppendToEmptyAsync()
{
FileHelperEngine engineOld = new FileHelperEngine(typeof (SampleType));
FileHelperAsyncEngine engine = new FileHelperAsyncEngine(typeof (SampleType));
SampleType rec = new SampleType();
rec.Field1 = DateTime.Now.AddDays(1).Date;
rec.Field2 = "je";
rec.Field3 = 0;
File.Copy(TestCommon.GetPath("Good", "TestEmpty.txt"), "tempEmpty.txt", true);
engine.BeginAppendToFile(@"tempEmpty.txt");
engine.WriteNext(rec);
engine.Close();
SampleType[] res2 = (SampleType[]) engineOld.ReadFile(@"tempEmpty.txt");
Assert.AreEqual(1, res2.Length);
Assert.AreEqual(rec.Field1, res2[0].Field1);
if (File.Exists("tempEmpty.txt")) File.Delete("tempEmpty.txt");
}
示例3: FileNotFound3
public void FileNotFound3()
{
engine2 = new FileHelperAsyncEngine(typeof (SampleType));
Assert.Throws<ArgumentNullException>(()
=> engine2.BeginAppendToFile(null));
}