• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# LabeledOperation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中LabeledOperation的典型用法代码示例。如果您正苦于以下问题:C# LabeledOperation类的具体用法?C# LabeledOperation怎么用?C# LabeledOperation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LabeledOperation类属于命名空间,在下文中一共展示了LabeledOperation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Distinct_Unordered_NotPipelined

 public static void Distinct_Unordered_NotPipelined(LabeledOperation source, LabeledOperation operation)
 {
     IntegerRangeSet seen = new IntegerRangeSet(DefaultStart, DefaultSize);
     ParallelQuery<int> query = operation.Item(DefaultStart * 2, DefaultSize * 2, source.Item).Select(x => x / 2).Distinct();
     Assert.All(query.ToList(), x => seen.Add((int)x));
     seen.AssertComplete();
 }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:7,代码来源:UnorderedParallelQueryCombinationTests.cs


示例2: Contains_OperationCanceledException_PreCanceled

        public static void Contains_OperationCanceledException_PreCanceled(LabeledOperation source, LabeledOperation operation)
        {
            CancellationTokenSource cs = new CancellationTokenSource();
            cs.Cancel();

            Functions.AssertIsCanceled(cs, () => operation.Item(DefaultStart, DefaultSize, source.Append(WithCancellation(cs.Token)).Item).Contains(DefaultStart));
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:7,代码来源:CancellationParallelQueryCombinationTests.cs


示例3: Aggregate_AggregateException

 public static void Aggregate_AggregateException(LabeledOperation source, LabeledOperation operation)
 {
     Functions.AssertThrowsWrapped<DeliberateTestException>(() => operation.Item(DefaultStart, DefaultSize, source.Item).Aggregate((x, y) => x));
     Functions.AssertThrowsWrapped<DeliberateTestException>(() => operation.Item(DefaultStart, DefaultSize, source.Item).Aggregate(0, (x, y) => x + y));
     Functions.AssertThrowsWrapped<DeliberateTestException>(() => operation.Item(DefaultStart, DefaultSize, source.Item).Aggregate(0, (x, y) => x + y, r => r));
     Functions.AssertThrowsWrapped<DeliberateTestException>(() => operation.Item(DefaultStart, DefaultSize, source.Item).Aggregate(0, (a, x) => a + x, (l, r) => l + r, r => r));
     Functions.AssertThrowsWrapped<DeliberateTestException>(() => operation.Item(DefaultStart, DefaultSize, source.Item).Aggregate(() => 0, (a, x) => a + x, (l, r) => l + r, r => r));
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:8,代码来源:ParallelQueryCombinationTests.cs


示例4: DefaultIfEmpty_Unordered

 public static void DefaultIfEmpty_Unordered(LabeledOperation source, LabeledOperation operation)
 {
     IntegerRangeSet seen = new IntegerRangeSet(DefaultStart, DefaultSize);
     foreach (int i in operation.Item(DefaultStart, DefaultSize, source.Item).DefaultIfEmpty())
     {
         seen.Add(i);
     }
     seen.AssertComplete();
 }
开发者ID:SGuyGe,项目名称:corefx,代码行数:9,代码来源:UnorderedParallelQueryCombinationTests.cs


示例5: Concat_Unordered_NotPipelined

 public static void Concat_Unordered_NotPipelined(LabeledOperation source, LabeledOperation operation)
 {
     IntegerRangeSet seen = new IntegerRangeSet(DefaultStart, DefaultSize);
     Assert.All(
         operation.Item(DefaultStart, DefaultSize / 2, source.Item)
             .Concat(operation.Item(DefaultStart + DefaultSize / 2, DefaultSize / 2, source.Item)).ToList(),
         x => seen.Add(x)
         );
     seen.AssertComplete();
 }
开发者ID:SGuyGe,项目名称:corefx,代码行数:10,代码来源:UnorderedParallelQueryCombinationTests.cs


示例6: Cast_Unordered

 public static void Cast_Unordered(LabeledOperation source, LabeledOperation operation)
 {
     IntegerRangeSet seen = new IntegerRangeSet(DefaultStart, DefaultSize);
     foreach (int? i in operation.Item(DefaultStart, DefaultSize, source.Item).Cast<int?>())
     {
         Assert.True(i.HasValue);
         seen.Add(i.Value);
     }
     seen.AssertComplete();
 }
开发者ID:SGuyGe,项目名称:corefx,代码行数:10,代码来源:UnorderedParallelQueryCombinationTests.cs


示例7: Distinct_Unordered

 public static void Distinct_Unordered(LabeledOperation source, LabeledOperation operation)
 {
     IntegerRangeSet seen = new IntegerRangeSet(DefaultStart, DefaultSize);
     ParallelQuery<int> query = operation.Item(DefaultStart * 2, DefaultSize * 2, source.Item).Select(x => x / 2).Distinct();
     foreach (int i in query)
     {
         seen.Add(i);
     }
     seen.AssertComplete();
 }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:10,代码来源:UnorderedParallelQueryCombinationTests.cs


示例8: Concat_Unordered

 public static void Concat_Unordered(LabeledOperation source, LabeledOperation operation)
 {
     IntegerRangeSet seen = new IntegerRangeSet(DefaultStart, DefaultSize);
     foreach (int i in operation.Item(DefaultStart, DefaultSize / 2, source.Item)
         .Concat(operation.Item(DefaultStart + DefaultSize / 2, DefaultSize / 2, source.Item)))
     {
         seen.Add(i);
     }
     seen.AssertComplete();
 }
开发者ID:SGuyGe,项目名称:corefx,代码行数:10,代码来源:UnorderedParallelQueryCombinationTests.cs


示例9: Aggregate_OperationCanceledException_PreCanceled

        public static void Aggregate_OperationCanceledException_PreCanceled(LabeledOperation source, LabeledOperation operation)
        {
            CancellationTokenSource cs = new CancellationTokenSource();
            cs.Cancel();

            Functions.AssertIsCanceled(cs, () => operation.Item(DefaultStart, DefaultSize, source.Append(WithCancellation(cs.Token)).Item).Aggregate((x, y) => x));
            Functions.AssertIsCanceled(cs, () => operation.Item(DefaultStart, DefaultSize, source.Append(WithCancellation(cs.Token)).Item).Aggregate(0, (x, y) => x + y));
            Functions.AssertIsCanceled(cs, () => operation.Item(DefaultStart, DefaultSize, source.Append(WithCancellation(cs.Token)).Item).Aggregate(0, (x, y) => x + y, r => r));
            Functions.AssertIsCanceled(cs, () => operation.Item(DefaultStart, DefaultSize, source.Append(WithCancellation(cs.Token)).Item).Aggregate(0, (a, x) => a + x, (l, r) => l + r, r => r));
            Functions.AssertIsCanceled(cs, () => operation.Item(DefaultStart, DefaultSize, source.Append(WithCancellation(cs.Token)).Item).Aggregate(() => 0, (a, x) => a + x, (l, r) => l + r, r => r));
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:11,代码来源:CancellationParallelQueryCombinationTests.cs


示例10: Except_Unordered

 public static void Except_Unordered(LabeledOperation source, LabeledOperation operation)
 {
     IntegerRangeSet seen = new IntegerRangeSet(DefaultStart, DefaultSize);
     ParallelQuery<int> query = operation.Item(DefaultStart, DefaultSize + DefaultSize / 2, source.Item)
         .Except(operation.Item(DefaultStart + DefaultSize, DefaultSize, source.Item));
     foreach (int i in query)
     {
         seen.Add(i);
     }
     seen.AssertComplete();
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:11,代码来源:UnorderedParallelQueryCombinationTests.cs


示例11: Where_Indexed_Unordered_NotPipelined

 public static void Where_Indexed_Unordered_NotPipelined(LabeledOperation source, LabeledOperation operation)
 {
     IntegerRangeSet seen = new IntegerRangeSet(DefaultStart, DefaultSize / 2);
     Assert.All(operation.Item(DefaultStart, DefaultSize, source.Item).Where((x, index) => x < DefaultStart + DefaultSize / 2).ToList(), x => seen.Add(x));
     seen.AssertComplete();
 }
开发者ID:SGuyGe,项目名称:corefx,代码行数:6,代码来源:UnorderedParallelQueryCombinationTests.cs


示例12: ToArray_Unordered

 public static void ToArray_Unordered(LabeledOperation source, LabeledOperation operation)
 {
     IntegerRangeSet seen = new IntegerRangeSet(DefaultStart, DefaultSize);
     Assert.All(operation.Item(DefaultStart, DefaultSize, source.Item).ToArray(), x => seen.Add(x));
     seen.AssertComplete();
 }
开发者ID:SGuyGe,项目名称:corefx,代码行数:6,代码来源:UnorderedParallelQueryCombinationTests.cs


示例13: Where_Indexed_Unordered

 public static void Where_Indexed_Unordered(LabeledOperation source, LabeledOperation operation)
 {
     IntegerRangeSet seen = new IntegerRangeSet(DefaultStart, DefaultSize / 2);
     foreach (int i in operation.Item(DefaultStart, DefaultSize, source.Item).Where((x, index) => x < DefaultStart + DefaultSize / 2))
     {
         seen.Add(i);
     }
     seen.AssertComplete();
 }
开发者ID:SGuyGe,项目名称:corefx,代码行数:9,代码来源:UnorderedParallelQueryCombinationTests.cs


示例14: GroupBy_ElementSelector_Unordered_NotPipelined

 public static void GroupBy_ElementSelector_Unordered_NotPipelined(LabeledOperation source, LabeledOperation operation)
 {
     IntegerRangeSet seenKey = new IntegerRangeSet(DefaultStart / GroupFactor, (DefaultSize + (GroupFactor - 1)) / GroupFactor);
     foreach (IGrouping<int, int> group in operation.Item(DefaultStart, DefaultSize, source.Item).GroupBy(x => x / GroupFactor, y => -y).ToList())
     {
         seenKey.Add(group.Key);
         IntegerRangeSet seenElement = new IntegerRangeSet(1 - Math.Min(DefaultStart + DefaultSize, (group.Key + 1) * GroupFactor), Math.Min(GroupFactor, DefaultSize - (group.Key - 1) * GroupFactor));
         Assert.All(group, x => seenElement.Add(x));
         seenElement.AssertComplete();
     }
     seenKey.AssertComplete();
 }
开发者ID:SGuyGe,项目名称:corefx,代码行数:12,代码来源:UnorderedParallelQueryCombinationTests.cs


示例15: Take_Unordered_NotPipelined

 public static void Take_Unordered_NotPipelined(LabeledOperation source, LabeledOperation operation)
 {
     IntegerRangeSet seen = new IntegerRangeSet(DefaultStart, DefaultSize);
     int count = 0;
     Assert.All(operation.Item(DefaultStart, DefaultSize, source.Item).Take(DefaultSize / 2).ToList(), x => { seen.Add(x); count++; });
     Assert.Equal(DefaultSize / 2, count);
 }
开发者ID:SGuyGe,项目名称:corefx,代码行数:7,代码来源:UnorderedParallelQueryCombinationTests.cs


示例16: GetEnumerator_Unordered

        public static void GetEnumerator_Unordered(LabeledOperation source, LabeledOperation operation)
        {
            IntegerRangeSet seen = new IntegerRangeSet(DefaultStart, DefaultSize);
            IEnumerator<int> enumerator = operation.Item(DefaultStart, DefaultSize, source.Item).GetEnumerator();
            while (enumerator.MoveNext())
            {
                int current = enumerator.Current;
                seen.Add(current);
                Assert.Equal(current, enumerator.Current);
            }
            seen.AssertComplete();

            Assert.Throws<NotSupportedException>(() => enumerator.Reset());
        }
开发者ID:SGuyGe,项目名称:corefx,代码行数:14,代码来源:UnorderedParallelQueryCombinationTests.cs


示例17: Select_Unordered

 public static void Select_Unordered(LabeledOperation source, LabeledOperation operation)
 {
     IntegerRangeSet seen = new IntegerRangeSet(-DefaultStart - DefaultSize + 1, DefaultSize);
     foreach (int i in operation.Item(DefaultStart, DefaultSize, source.Item).Select(x => -x))
     {
         seen.Add(i);
     }
     seen.AssertComplete();
 }
开发者ID:SGuyGe,项目名称:corefx,代码行数:9,代码来源:UnorderedParallelQueryCombinationTests.cs


示例18: SelectMany_ResultSelector_Unordered

 public static void SelectMany_ResultSelector_Unordered(LabeledOperation source, LabeledOperation operation)
 {
     IntegerRangeSet seen = new IntegerRangeSet(-DefaultStart - DefaultSize * 2 + 1, DefaultSize * 2);
     foreach (int i in operation.Item(0, DefaultSize, source.Item).SelectMany(x => new[] { 0, -1 }, (x, y) => y + -DefaultStart - 2 * x))
     {
         seen.Add(i);
     }
     seen.AssertComplete();
 }
开发者ID:SGuyGe,项目名称:corefx,代码行数:9,代码来源:UnorderedParallelQueryCombinationTests.cs


示例19: SelectMany_Indexed_ResultSelector_Unordered

 public static void SelectMany_Indexed_ResultSelector_Unordered(LabeledOperation source, LabeledOperation operation)
 {
     IntegerRangeSet seen = new IntegerRangeSet(-DefaultStart - DefaultSize * 2 + 1, DefaultSize * 2);
     IntegerRangeSet indices = new IntegerRangeSet(0, DefaultSize);
     foreach (int i in operation.Item(0, DefaultSize, source.Item).SelectMany((x, index) => { indices.Add(index); return new[] { 0, -1 }; }, (x, y) => y + -DefaultStart - 2 * x))
     {
         seen.Add(i);
     }
     seen.AssertComplete();
     indices.AssertComplete();
 }
开发者ID:SGuyGe,项目名称:corefx,代码行数:11,代码来源:UnorderedParallelQueryCombinationTests.cs


示例20: GroupJoin_Unordered_NotPipelined

 public static void GroupJoin_Unordered_NotPipelined(LabeledOperation source, LabeledOperation operation)
 {
     IntegerRangeSet seenKey = new IntegerRangeSet(DefaultStart / GroupFactor, DefaultSize / GroupFactor);
     foreach (KeyValuePair<int, IEnumerable<int>> group in operation.Item(DefaultStart / GroupFactor, DefaultSize / GroupFactor, source.Item)
         .GroupJoin(operation.Item(DefaultStart, DefaultSize, source.Item), x => x, y => y / GroupFactor, (k, g) => new KeyValuePair<int, IEnumerable<int>>(k, g)).ToList())
     {
         Assert.True(seenKey.Add(group.Key));
         IntegerRangeSet seenElement = new IntegerRangeSet(group.Key * GroupFactor, GroupFactor);
         Assert.All(group.Value, x => seenElement.Add(x));
         seenElement.AssertComplete();
     }
     seenKey.AssertComplete();
 }
开发者ID:SGuyGe,项目名称:corefx,代码行数:13,代码来源:UnorderedParallelQueryCombinationTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# LambdaExpression类代码示例发布时间:2022-05-24
下一篇:
C# Labeled类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap