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


C# IObservable.AsOperational方法代码示例

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


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

示例1: AsOperationalInternal

    private static OperationalObservable<short, int> AsOperationalInternal(
      IObservable<short> source,
      Func<IObservable<short>, IObservable<short>, Func<short, short, int>, IObservable<int>> binaryOperation = null,
      Func<IObservable<int>, IObservable<int>, Func<int, int, int>, IObservable<int>> resultBinaryOperation = null,
      Func<IObservable<short>, IObservable<int>, Func<short, int, int>, IObservable<int>> shiftOperation = null,
      Func<IObservable<short>, IObservable<short>, Func<short, short, bool>, IObservable<bool>> comparisonOperation = null,
      IComparer<short> comparer = null,
      IEqualityComparer<short> equalityComparer = null)
    {
      Contract.Requires(source != null);
      Contract.Ensures(!object.Equals(Contract.Result<OperationalObservable<short, int>>(), null));

      return source.AsOperational(
        result => AsOperationalInternal(result, resultBinaryOperation),
        binaryOperation: binaryOperation,
        comparisonOperation: comparisonOperation,
        shiftOperation: shiftOperation,
        add: (first, second) => first + second,
        subtract: (first, second) => first - second,
        multiply: (first, second) => first * second,
        divide: (first, second) => first / second,
        remainder: (first, second) => first % second,
        leftShift: (first, second) => first << second,
        rightShift: (first, second) => first >> second,
        positive: value => +value,
        negative: value => -value,
        complement: value => ~value,
        not: null,
        equals: (first, second) => equalityComparer == null ? first == second : equalityComparer.Equals(first, second),
        notEquals: (first, second) => equalityComparer == null ? first != second : !equalityComparer.Equals(first, second),
        lessThan: (first, second) => comparer == null ? first < second : comparer.Compare(first, second) < 0,
        lessThanOrEqual: (first, second) => comparer == null ? first <= second : comparer.Compare(first, second) <= 0,
        greaterThan: (first, second) => comparer == null ? first > second : comparer.Compare(first, second) > 0,
        greaterThanOrEqual: (first, second) => comparer == null ? first >= second : comparer.Compare(first, second) >= 0,
        and: (first, second) => first & second,
        or: (first, second) => first | second,
        xor: (first, second) => first ^ second);
    }
开发者ID:ibebbs,项目名称:Rxx,代码行数:38,代码来源:OperationalObservable+-+Primitives.cs


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