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

C# IntegerRangeSet类代码示例

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

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



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

示例1: Reverse_Unordered_NotPipelined

 public static void Reverse_Unordered_NotPipelined(Labeled<ParallelQuery<int>> labeled, int count)
 {
     ParallelQuery<int> query = labeled.Item;
     IntegerRangeSet seen = new IntegerRangeSet(0, count);
     Assert.All(query.Reverse().ToList(), x => seen.Add(x));
     seen.AssertComplete();
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:7,代码来源:ReverseTests.cs


示例2: ToDictionary

 public static void ToDictionary(int count)
 {
     IntegerRangeSet seen = new IntegerRangeSet(0, count);
     Assert.All(UnorderedSources.Default(count).ToDictionary(x => x * 2),
         p => { seen.Add(p.Key / 2); Assert.Equal(p.Key, p.Value * 2); });
     seen.AssertComplete();
 }
开发者ID:ChuangYang,项目名称:corefx,代码行数:7,代码来源:ToDictionaryTests.cs


示例3: ToDictionary_ElementSelector_CustomComparator

 public static void ToDictionary_ElementSelector_CustomComparator(int count)
 {
     IntegerRangeSet seen = new IntegerRangeSet(0, count);
     Assert.All(UnorderedSources.Default(count).ToDictionary(x => x, y => y * 2, new ModularCongruenceComparer(count)),
         p => { seen.Add(p.Key); Assert.Equal(p.Key * 2, p.Value); });
     seen.AssertComplete();
 }
开发者ID:ChuangYang,项目名称:corefx,代码行数:7,代码来源:ToDictionaryTests.cs


示例4: Cast_Unordered_Valid_NotPipelined

 public static void Cast_Unordered_Valid_NotPipelined(Labeled<ParallelQuery<int>> labeled, int count)
 {
     ParallelQuery<int> query = labeled.Item;
     IntegerRangeSet seen = new IntegerRangeSet(0, count);
     Assert.All(query.Select(x => (object)x).Cast<int>().ToList(), x => seen.Add(x));
     seen.AssertComplete();
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:7,代码来源:CastTests.cs


示例5: GetEnumerator_Unordered

        public static void GetEnumerator_Unordered(Labeled<ParallelQuery<int>> labeled, int count)
        {
            IntegerRangeSet seen = new IntegerRangeSet(0, count);
            IEnumerator<int> enumerator = labeled.Item.GetEnumerator();
            if (count == 0 && labeled.ToString().Contains("Array"))
            {
                Assert.Same(enumerator, labeled.Item.GetEnumerator());
            }
            else
            {
                Assert.NotSame(enumerator, labeled.Item.GetEnumerator());
            }
            while (enumerator.MoveNext())
            {
                int current = enumerator.Current;
                seen.Add(current);
                Assert.Equal(current, enumerator.Current);
            }
            seen.AssertComplete();

            if (labeled.ToString().StartsWith("Enumerable.Range") || labeled.ToString().StartsWith("Partitioner"))
            {
                Assert.Throws<NotSupportedException>(() => enumerator.Reset());
            }
            else
            {
                enumerator.Reset();
                seen = new IntegerRangeSet(0, count);
                while (enumerator.MoveNext())
                {
                    Assert.True(seen.Add(enumerator.Current));
                }
                seen.AssertComplete();
            }
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:35,代码来源:GetEnumeratorTests.cs


示例6: 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


示例7: Single_NoMatch

 public static void Single_NoMatch(Labeled<ParallelQuery<int>> labeled, int count, int element)
 {
     ParallelQuery<int> query = labeled.Item;
     IntegerRangeSet seen = new IntegerRangeSet(0, count);
     Assert.Throws<InvalidOperationException>(() => query.Single(x => !seen.Add(x)));
     seen.AssertComplete();
 }
开发者ID:jmhardison,项目名称:corefx,代码行数:7,代码来源:SingleSingleOrDefaultTests.cs


示例8: ForAll

 public static void ForAll(Labeled<ParallelQuery<int>> labeled, int count)
 {
     ParallelQuery<int> query = labeled.Item;
     IntegerRangeSet seen = new IntegerRangeSet(0, count);
     query.ForAll<int>(x => seen.Add(x));
     seen.AssertComplete();
 }
开发者ID:SGuyGe,项目名称:corefx,代码行数:7,代码来源:ForAllTests.cs


示例9: ToArray_Unordered

 public static void ToArray_Unordered(Labeled<ParallelQuery<int>> labeled, int count)
 {
     ParallelQuery<int> query = labeled.Item;
     IntegerRangeSet seen = new IntegerRangeSet(0, count);
     Assert.All(query.ToArray(), x => seen.Add(x));
     seen.AssertComplete();
 }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:7,代码来源:ToArrayTests.cs


示例10: Where_Unordered_NotPipelined

 public static void Where_Unordered_NotPipelined(Labeled<ParallelQuery<int>> labeled, int count)
 {
     ParallelQuery<int> query = labeled.Item;
     IntegerRangeSet seen = new IntegerRangeSet(0, (count + 1) / 2);
     Assert.All(query.Where(x => x % 2 == 0).ToList(), x => seen.Add(x / 2));
     seen.AssertComplete();
 }
开发者ID:shiftkey-tester,项目名称:corefx,代码行数:7,代码来源:WhereTests.cs


示例11: Select_Unordered_NotPipelined

 public static void Select_Unordered_NotPipelined(int count)
 {
     IntegerRangeSet seen = new IntegerRangeSet(0, count);
     Assert.All(UnorderedSources.Default(count).Select(x => KeyValuePair.Create(x, x * x)).ToList(),
         p => { seen.Add(p.Key); Assert.Equal(p.Key * p.Key, p.Value); });
     seen.AssertComplete();
 }
开发者ID:ESgarbi,项目名称:corefx,代码行数:7,代码来源:SelectSelectManyTests.cs


示例12: AsSequential_Unordered

 public static void AsSequential_Unordered(Labeled<ParallelQuery<int>> labeled, int count)
 {
     IntegerRangeSet seen = new IntegerRangeSet(0, count);
     IEnumerable<int> seq = labeled.Item.AsSequential();
     Assert.All(seq, x => seen.Add(x));
     seen.AssertComplete();
 }
开发者ID:benpye,项目名称:corefx,代码行数:7,代码来源:AsSequentialTests.cs


示例13: Any_AllFalse

 public static void Any_AllFalse(Labeled<ParallelQuery<int>> labeled, int count)
 {
     ParallelQuery<int> query = labeled.Item;
     IntegerRangeSet seen = new IntegerRangeSet(0, count);
     Assert.False(query.Any(x => !seen.Add(x)));
     seen.AssertComplete();
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:7,代码来源:AnyTests.cs


示例14: ToDictionary

 public static void ToDictionary(Labeled<ParallelQuery<int>> labeled, int count)
 {
     ParallelQuery<int> query = labeled.Item;
     IntegerRangeSet seen = new IntegerRangeSet(0, count);
     Assert.All(query.ToDictionary(x => x * 2),
         p => { seen.Add(p.Key / 2); Assert.Equal(p.Key, p.Value * 2); });
     seen.AssertComplete();
 }
开发者ID:benpye,项目名称:corefx,代码行数:8,代码来源:ToDictionaryTests.cs


示例15: Skip_Unordered_NotPipelined

 public static void Skip_Unordered_NotPipelined(int count, int skip)
 {
     // For unordered collections, which elements are skipped isn't actually guaranteed, but an effect of the implementation.
     // If this test starts failing it should be updated, and possibly mentioned in release notes.
     IntegerRangeSet seen = new IntegerRangeSet(Math.Max(skip, 0), Math.Min(count, Math.Max(0, count - skip)));
     Assert.All(UnorderedSources.Default(count).Skip(skip).ToList(), x => seen.Add(x));
     seen.AssertComplete();
 }
开发者ID:ChuangYang,项目名称:corefx,代码行数:8,代码来源:SkipSkipWhileTests.cs


示例16: Concat_Unordered_NotPipelined

 public static void Concat_Unordered_NotPipelined(Labeled<ParallelQuery<int>> left, int leftCount, Labeled<ParallelQuery<int>> right, int rightCount)
 {
     ParallelQuery<int> leftQuery = left.Item;
     ParallelQuery<int> rightQuery = right.Item;
     IntegerRangeSet seen = new IntegerRangeSet(0, leftCount + rightCount);
     Assert.All(leftQuery.Concat(rightQuery).ToList(), x => seen.Add(x));
     seen.AssertComplete();
 }
开发者ID:SGuyGe,项目名称:corefx,代码行数:8,代码来源:ConcatTests.cs


示例17: ToDictionary_ElementSelector_CustomComparator

 public static void ToDictionary_ElementSelector_CustomComparator(Labeled<ParallelQuery<int>> labeled, int count)
 {
     ParallelQuery<int> query = labeled.Item;
     IntegerRangeSet seen = new IntegerRangeSet(0, count);
     Assert.All(query.ToDictionary(x => x, y => y * 2, new ModularCongruenceComparer(count)),
         p => { seen.Add(p.Key); Assert.Equal(p.Key * 2, p.Value); });
     seen.AssertComplete();
 }
开发者ID:benpye,项目名称:corefx,代码行数:8,代码来源:ToDictionaryTests.cs


示例18: Select_Unordered_NotPipelined

 public static void Select_Unordered_NotPipelined(Labeled<ParallelQuery<int>> labeled, int count)
 {
     ParallelQuery<int> query = labeled.Item;
     IntegerRangeSet seen = new IntegerRangeSet(0, count);
     Assert.All(query.Select(x => KeyValuePair.Create(x, x * x)).ToList(),
         p => { seen.Add(p.Key); Assert.Equal(p.Key * p.Key, p.Value); });
     seen.AssertComplete();
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:8,代码来源:SelectSelectManyTests.cs


示例19: Reverse_Unordered

 public static void Reverse_Unordered(int count)
 {
     IntegerRangeSet seen = new IntegerRangeSet(0, count);
     foreach (int i in UnorderedSources.Default(count).Reverse())
     {
         seen.Add(i);
     }
     seen.AssertComplete();
 }
开发者ID:ESgarbi,项目名称:corefx,代码行数:9,代码来源:ReverseTests.cs


示例20: Join_Unordered_NotPipelined

 public static void Join_Unordered_NotPipelined(Labeled<ParallelQuery<int>> left, int leftCount, Labeled<ParallelQuery<int>> right, int rightCount)
 {
     ParallelQuery<int> leftQuery = left.Item;
     ParallelQuery<int> rightQuery = right.Item;
     IntegerRangeSet seen = new IntegerRangeSet(0, Math.Min(leftCount, (rightCount + (KeyFactor - 1)) / KeyFactor));
     Assert.All(leftQuery.Join(rightQuery, x => x * KeyFactor, y => y, (x, y) => KeyValuePair.Create(x, y)).ToList(),
         p => { Assert.Equal(p.Key * KeyFactor, p.Value); seen.Add(p.Key); });
     seen.AssertComplete();
 }
开发者ID:shiftkey-tester,项目名称:corefx,代码行数:9,代码来源:JoinTests.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IntelligentCreatureType类代码示例发布时间:2022-05-24
下一篇:
C# Integer32类代码示例发布时间: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