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


C# Subject.Buffer方法代码示例

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


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

示例1: BufferedHandler

 public BufferedHandler(TimeSpan timeDelay, int batchSize)
 {
     _storiesSubject = new Subject<IStory>();
     _storiesSubject.Buffer(timeDelay, batchSize)
     .Where(buffer => buffer.Any())
     .Subscribe(OnStoriesComplete, OnComplete);
 }
开发者ID:amitapl,项目名称:logmetry,代码行数:7,代码来源:BufferedHandler.cs

示例2: BufferedHandler

 protected BufferedHandler(string name, TimeSpan timeDelay, int batchSize)
     : base(name)
 {
     _storiesSubject = new Subject<IStory>();
     _storiesSubject.Buffer(timeDelay, batchSize)
                    .Where(buffer => buffer.Any())
                    .Subscribe(OnStoriesComplete, OnComplete);
 }
开发者ID:narratr,项目名称:story,代码行数:8,代码来源:BufferedHandler.cs

示例3: Buffering

        public void Buffering()
        {
            var received = new List<String>();
            var events = new Subject<char>();
            events.Buffer(TimeSpan.FromMilliseconds(100)).Select(c => new String(c.ToArray())).Subscribe(s => received.Add(s));
              events.OnNext('S');
            events.OnNext('c');
            events.OnNext('o');
            events.OnNext('t');
            events.OnNext('t');
            Thread.Sleep(120);

            events.OnNext('R');
            events.OnNext('e');
            events.OnNext('e');
            events.OnNext('d');
            Thread.Sleep(120);

            Assert.AreEqual("Scott Reed", String.Join(" ", received));
        }
开发者ID:alwalker,项目名称:rx_koans,代码行数:20,代码来源:Lesson4Time.cs

示例4: SetupListener

 private void SetupListener()
 {
     messagePump = new Subject<LogMessage>();
     messagePump.Buffer(TimeSpan.FromSeconds(1)).Subscribe(MessageReceivedAction);
 }
开发者ID:prasannavl,项目名称:Liara,代码行数:5,代码来源:ConsoleLogWriter.cs

示例5: BufferWindowBoundaries

        public void BufferWindowBoundaries()
        {
            var subject = new Subject<int>();
            var boundaries = new Subject<int>();

            var record = subject.Buffer(boundaries).Record();

            subject.OnNext(1);
            subject.OnNext(2);
            record.Values.Count.Is(0);

            boundaries.OnNext(0);
            record.Values.Count.Is(1);
            record.Values[0].IsCollection(1, 2);

            boundaries.OnNext(0);
            record.Values.Count.Is(2);
            record.Values[1].Count.Is(0);
        }
开发者ID:byfar,项目名称:UniRx,代码行数:19,代码来源:UnitTests.cs

示例6: BufferTimeAndCountTimeSide

        public void BufferTimeAndCountTimeSide()
        {
            var subject = new Subject<int>();
            var record = subject.Buffer(TimeSpan.FromMilliseconds(100), 100).Take(5).Record();

            Thread.Sleep(TimeSpan.FromSeconds(2));

            record.Values.Count.Is(5);
        }
开发者ID:byfar,项目名称:UniRx,代码行数:9,代码来源:UnitTests.cs

示例7: BufferWindowBoundaries

 public void BufferWindowBoundaries()
 {
     SetScehdulerForImport();
     var subject = new Subject<int>();
     var boundaries = new Subject<int>();
     var record = subject.Buffer(boundaries).Record();
     subject.OnNext(1);
     subject.OnNext(2);
     record.Values.Count.Is(0);
     boundaries.OnNext(0);
     record.Values.Count.Is(1);
     record.Values[0].IsCollection(1, 2);
     boundaries.OnNext(0);
     record.Values.Count.Is(2);
     record.Values[1].Count.Is(0);
     UniRx.Scheduler.SetDefaultForUnity();
 }
开发者ID:neuecc,项目名称:UniRx,代码行数:17,代码来源:TestImporter.cs

示例8: BufferTimeAndCountTimeSide

 public void BufferTimeAndCountTimeSide()
 {
     SetScehdulerForImport();
     var subject = new Subject<int>();
     var record = subject.Buffer(TimeSpan.FromMilliseconds(100), 100).Take(5).Record();
     Thread.Sleep(TimeSpan.FromSeconds(2));
     record.Values.Count.Is(5);
     UniRx.Scheduler.SetDefaultForUnity();
 }
开发者ID:neuecc,项目名称:UniRx,代码行数:9,代码来源:TestImporter.cs


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