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


C# IntegerRangeSet.Add方法代码示例

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


在下文中一共展示了IntegerRangeSet.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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