当前位置: 首页>>代码示例>>C#>>正文


C# FileHelperAsyncEngine.WriteNexts方法代码示例

本文整理汇总了C#中FileHelperAsyncEngine.WriteNexts方法的典型用法代码示例。如果您正苦于以下问题:C# FileHelperAsyncEngine.WriteNexts方法的具体用法?C# FileHelperAsyncEngine.WriteNexts怎么用?C# FileHelperAsyncEngine.WriteNexts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileHelperAsyncEngine的用法示例。


在下文中一共展示了FileHelperAsyncEngine.WriteNexts方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteEvents

        public void WriteEvents()
        {
            before = 0;
            after = 0;

            engine = new FileHelperAsyncEngine<SampleType>();

            engine.BeforeWriteRecord += new BeforeWriteHandler<SampleType>(engine_BeforeWriteRecord);
            engine.AfterWriteRecord += new AfterWriteHandler<SampleType>(engine_AfterWriteRecord);

            var res = new SampleType[2];

            res[0] = new SampleType();
            res[1] = new SampleType();

            res[0].Field1 = DateTime.Now.AddDays(1);
            res[0].Field2 = "je";
            res[0].Field3 = 0;

            res[1].Field1 = DateTime.Now;
            res[1].Field2 = "ho";
            res[1].Field3 = 2;

            engine.BeginWriteFile("tempEvent.txt");
            engine.WriteNexts(res);
            engine.Close();

            File.Delete("tempEvent.txt");
            Assert.AreEqual(2, engine.TotalRecords);
            Assert.AreEqual(2, before);
            Assert.AreEqual(2, after);
        }
开发者ID:mgmccarthy,项目名称:FileHelpers,代码行数:32,代码来源:EventsAsync.cs

示例2: NullRecords2

        public void NullRecords2()
        {
            engine2 = new FileHelperAsyncEngine(typeof (SampleType));
            engine2.BeginWriteStream(new StringWriter(new StringBuilder()));

            Assert.Throws<ArgumentNullException>(()
                => engine2.WriteNexts(null));
        }
开发者ID:hoffmanc,项目名称:FileHelpers,代码行数:8,代码来源:OtherErrors.cs

示例3: DiscardWriteRead2

        public void DiscardWriteRead2()
        {
            var engine = new FileHelperEngine<DiscardLastType1>();

            DiscardLastType1[] res = TestCommon.ReadTest<DiscardLastType1>(engine, "Good", "DiscardLast1.txt");

            var asyncEngine = new FileHelperAsyncEngine<DiscardLastType1>();

            asyncEngine.FooterText = "This is a new Footer....";

            asyncEngine.BeginWriteFile("temp.txt");
            asyncEngine.WriteNexts(res);
            asyncEngine.Close();

            asyncEngine.FooterText = "none none";

            asyncEngine.BeginReadFile("temp.txt");

            while (asyncEngine.ReadNext() != null) {}

            Assert.AreEqual(res.Length, asyncEngine.TotalRecords);
            Assert.AreEqual(expectedShortFooterText, asyncEngine.FooterText);

            asyncEngine.Close();

            Assert.AreEqual(res.Length, asyncEngine.TotalRecords);
            Assert.AreEqual(expectedShortFooterText, asyncEngine.FooterText);

            if (File.Exists("tempo.txt"))
                File.Delete("tempo.txt");
        }
开发者ID:abombss,项目名称:FileHelpers,代码行数:31,代码来源:IgnoreLast.cs

示例4: NullRecords2

		public void NullRecords2()
		{
			engine2 = new FileHelperAsyncEngine(typeof (SampleType));
			engine2.BeginWriteStream(new StringWriter(new StringBuilder()));

			engine2.WriteNexts(null);
		}
开发者ID:BD-GitHub,项目名称:filehelpers,代码行数:7,代码来源:OtherErrors.cs

示例5: DiscardWriteRead2

        public void DiscardWriteRead2()
        {
            engine = new FileHelperEngine(typeof(DiscardType1));

            DiscardType1[] res = (DiscardType1[])Common.ReadTest(engine, @"Good\DiscardFirst1.txt");

            asyncEngine = new FileHelperAsyncEngine(typeof(DiscardType1));

            asyncEngine.HeaderText = "This is a new header....";

            asyncEngine.BeginWriteFile("tempo.txt");
            asyncEngine.WriteNexts(res);
            asyncEngine.Close();

            asyncEngine.HeaderText = "none none\r\n";

            asyncEngine.BeginReadFile(@"tempo.txt");

            while (asyncEngine.ReadNext() != null)
            {}

            Assert.AreEqual(res.Length, asyncEngine.TotalRecords);
            Assert.AreEqual("This is a new header....\r\n", asyncEngine.HeaderText);

            asyncEngine.Close();

            Assert.AreEqual(res.Length, asyncEngine.TotalRecords);
            Assert.AreEqual("This is a new header....\r\n", asyncEngine.HeaderText);

            if (File.Exists("tempo.txt")) File.Delete("tempo.txt");

        }
开发者ID:BD-GitHub,项目名称:filehelpers,代码行数:32,代码来源:IgnoreFirst.cs

示例6: DiscardWriteRead2

        public void DiscardWriteRead2()
        {
            var engine = new FileHelperEngine<DiscardType1>();

            DiscardType1[] res = engine.ReadFile(FileTest.Good.DiscardFirst1.Path);

            var asyncEngine = new FileHelperAsyncEngine<DiscardType1>();

            asyncEngine.HeaderText = "This is a new header....";

            asyncEngine.BeginWriteFile("tempo.txt");
            asyncEngine.WriteNexts(res);
            asyncEngine.Close();

            asyncEngine.HeaderText = "none none\r\n";

            asyncEngine.BeginReadFile(@"tempo.txt");

            while (asyncEngine.ReadNext() != null) {}

            Assert.AreEqual(res.Length, asyncEngine.TotalRecords);
            Assert.AreEqual(mExpectedShortHeaderText, asyncEngine.HeaderText);

            asyncEngine.Close();

            Assert.AreEqual(res.Length, asyncEngine.TotalRecords);
            Assert.AreEqual(mExpectedShortHeaderText, asyncEngine.HeaderText);

            if (File.Exists("tempo.txt"))
                File.Delete("tempo.txt");
        }
开发者ID:AlexKasaku,项目名称:FileHelpers,代码行数:31,代码来源:IgnoreFirst.cs


注:本文中的FileHelperAsyncEngine.WriteNexts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。