ããã·ã¼ã±ã³ã¹ããã£ãã¨ãã¦ãæåã«æµãã¦ãããã®ããnç§éã¯ãã¹ã¦è¦ç´ ãæ¨ã¦ã¦ãnç§ä»¥ä¸ãã£ãæã®æåã®è¦ç´ ã¯å¾ãã«ãªãããã¨ãããããªãã¨ãRxã§ã§ããªãã®ï¼ã¨ãããããã«èãã¦ã¿ããã ãã©ã©ãããä½ããªãã¨ã ãã ãã¼ãã¨è¨ããã¦ãã¾ã£ãã®ã§ä½ã£ã¦ã¿ã¾ããã
ãããããã¨ã®ã¤ã¡ã¼ã¸ã¯ä¸å³ã®ã¨ãããéåºéã¯éãã¦ã赤åºéã«ããè¦ç´ ã¯æµãã¾ããã
public static class Hoge { public static IObservable<T> Filter<T>(this IObservable<T> seq, TimeSpan t) { return Observable.Create<T>(a => { var ts = DateTimeOffset.MinValue; return seq.Timestamp().Subscribe(value => { if (!((value.Timestamp - ts) >= t)) return; ts = value.Timestamp; a.OnNext(value.Value); }, seq.OnError, seq.OnCompleted); }); } }
ã¦ãã¨ããªæ¡å¼µã¡ã½ãããä½ã£ã¦ãObservable.Create ã使ã£ã¦æ°ããã·ã¼ã±ã³ã¹ãçæãã¦ãå¤æãããã¾ããã