本文整理汇总了C#中Subject.AsOperational方法的典型用法代码示例。如果您正苦于以下问题:C# Subject.AsOperational方法的具体用法?C# Subject.AsOperational怎么用?C# Subject.AsOperational使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subject
的用法示例。
在下文中一共展示了Subject.AsOperational方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BasicExperiment
public void BasicExperiment()
{
var xs = new Subject<int>();
var ys = new Subject<int>();
var zs = new Subject<int>();
IObservable<int> query = xs.AsOperational() + ys - zs;
using (query.Subscribe(ConsoleOutput))
{
xs.OnNext(1);
ys.OnNext(5);
zs.OnNext(2);
xs.OnNext(2);
ys.OnNext(6);
zs.OnNext(3);
xs.OnNext(3);
xs.OnNext(4);
zs.OnNext(4);
zs.OnNext(5);
ys.OnNext(7);
ys.OnNext(8);
WaitForKey();
}
}
示例2: EqualityComparisonExperiment
public void EqualityComparisonExperiment()
{
var a = new object();
var b = new object();
var c = new object();
var xs = new Subject<object>();
var ys = new Subject<object>();
var zs = new Subject<object>();
IObservable<bool> query = xs.AsOperational() == ys | zs.AsOperational() == b;
using (query.Subscribe(ConsoleOutput))
{
xs.OnNext(a);
ys.OnNext(a);
zs.OnNext(c);
xs.OnNext(c);
ys.OnNext(b);
zs.OnNext(a);
xs.OnNext(b);
ys.OnNext(c);
zs.OnNext(b);
xs.OnNext(c);
ys.OnNext(c);
zs.OnNext(a);
xs.OnNext(b);
ys.OnNext(b);
zs.OnNext(a);
xs.OnNext(a);
ys.OnNext(c);
zs.OnNext(c);
WaitForKey();
}
}
示例3: ComparisonExperiment
public void ComparisonExperiment()
{
var xs = new Subject<int>();
var ys = new Subject<int>();
var zs = new Subject<int>();
IObservable<bool> query = xs.AsOperational() < ys & zs.AsOperational() >= 5;
using (query.Subscribe(ConsoleOutput))
{
xs.OnNext(1);
ys.OnNext(2);
zs.OnNext(3);
xs.OnNext(4);
ys.OnNext(5);
zs.OnNext(6);
xs.OnNext(7);
ys.OnNext(8);
zs.OnNext(4);
xs.OnNext(5);
ys.OnNext(1);
zs.OnNext(5);
xs.OnNext(6);
ys.OnNext(6);
zs.OnNext(8);
xs.OnNext(3);
ys.OnNext(4);
zs.OnNext(2);
xs.OnNext(3);
ys.OnNext(4);
zs.OnNext(6);
WaitForKey();
}
}
示例4: ReactiveExpressionExperiment
public void ReactiveExpressionExperiment()
{
var xs = new Subject<int>();
var ys = new Subject<int>();
var zs = new Subject<int>();
var suffix = new Subject<string>();
var os = xs.AsOperational(Observable.CombineLatest);
IObservable<int> math = (os * 2) + ys - zs;
IObservable<string> format = math
.Select(v => v.ToString(CultureInfo.CurrentCulture))
.AsOperational(Observable.CombineLatest)
+ suffix;
using (format.Subscribe(ConsoleOutput))
{
xs.OnNext(1);
ys.OnNext(1);
zs.OnNext(1);
suffix.OnNext("!");
zs.OnNext(4);
ys.OnNext(0);
zs.OnNext(2);
xs.OnNext(5);
suffix.OnNext("?");
xs.OnNext(10);
suffix.OnNext(".");
WaitForKey();
}
}