rx文档/帮助 [英] rx documentation / help

查看:88
本文介绍了rx文档/帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚下载了最新的RX,并对新推出的函数缺少单句文档感到疑惑。


我想了解BufferWithTime与之间的区别。 WindowWithTime。如果帮助文件中有一个单独的句子,该函数应该做什么,这将是非常有帮助的。例如,如果这是一个跳跃
或滑动窗口的写作会有很大帮助。现在作为开发人员,您会感觉如下:


窗口

WindowWithTime

BufferWithTime


啊哈!好。滑动窗口?跳窗?谷歌搜索。发现实施已更改。啊哈。编写程序来详细说明这些功能的作用。买反射器。反映集会,了解最新情况。 ...

解决方案

好的,我将这三个运算符视为层次结构。


窗口–根据您想要的任何逻辑将流分割成窗口。


 


WindowWithTime –根据指定的时间段将一个流吐出到窗口中(将使用Window实现)。


var windowWithTime = source.Window(()=> Observable.Timer(TimeSpan.FromSeconds( 1))


 


BufferWithTime –根据时间将流吐入窗口,但聚合所有通知进入一个缓冲区,一旦窗口关闭就会给你(完成).BufferWithTime将使用WindowWithTime实现。


var bufferWithTime =

     from w in source.WindowWithTime(TimeSpan.FromSeconds(1))

    from b in w.ToList()

    选择b;




注意:在最新版本的Rx中,WindowWithTime& BufferWithTime只称为Window& Buffer。


I just downladed the latest RX and wonder about the lack of single-sentence documentation of newly introduced functions.

In particular I would like to understand the difference between BufferWithTime and WindowWithTime. If there would be a single sentence in the help file what the function is supposed to do it would be very helpful. For instance writing if this is a hopping or slinding window would help a lot. Now as a developer you feel like this:

Window
WindowWithTime
BufferWithTime

aha! ok. sliding window? hopping window? googling. find that implementations changed. aha. writing a program to elaborate what these functions do. buying reflector. reflecting assemblies to understand whats going on. ...

解决方案

Ok, I see these three operators as a hierarchy.

Window – splits a stream into windows based on whatever logic you want.

 

WindowWithTime – spits a stream into windows based on the specified time period (would be implemented with Window).

var windowWithTime = source.Window(() => Observable.Timer(TimeSpan.FromSeconds(1))

 

BufferWithTime – spits the stream into windows based on time, but aggregates all the notifications into a buffer, that it will give you once the window closes (is complete). BufferWithTime would be implemented using WindowWithTime.

var bufferWithTime =
    from w in source.WindowWithTime(TimeSpan.FromSeconds(1))
    from b in w.ToList()
    select b;


NOTE: in the latest version of Rx, WindowWithTime & BufferWithTime are just called Window & Buffer.


这篇关于rx文档/帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆