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


C# SortedDictionary.HasSeveralItems方法代码示例

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


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

示例1: HasSeveralItemsArrayPredicate

        public void HasSeveralItemsArrayPredicate()
        {
            var x = Enumerable.Range(1, 1024).ToArray();
            var y = Enumerable.Range(1, 1024).Select(a => new Tuple<int, int>(a,a)).ToArray();
            var z = Enumerable.Range(1, 1024).Select(a => new { A = a}).ToArray();
            var dict = new SortedDictionary<int, int>(x.ToDictionary(a => a, a => a));
			Assert.IsTrue(x.HasSeveralItems(10, val => val%3 == 0));
			Assert.IsTrue(x.HasSeveralItems(300, val => val%3 == 0));
			Assert.IsFalse(x.HasSeveralItems(1025, val => val%3 == 0));			
			Assert.IsTrue(y.HasSeveralItems(10, val => val.Item1%3 == 0));
			Assert.IsTrue(y.HasSeveralItems(300, val => val.Item1%3 == 0));
			Assert.IsFalse(y.HasSeveralItems(1025, val => val.Item1%3 == 0));
			Assert.IsTrue(z.HasSeveralItems(10, val => val.A%3 == 0));
			Assert.IsTrue(z.HasSeveralItems(300, val => val.A%3 == 0));
			Assert.IsFalse(z.HasSeveralItems(1025, val => val.A%3 == 0));
			Assert.IsTrue(dict.HasSeveralItems(10, val => val.Key%3 == 0));
			Assert.IsTrue(dict.HasSeveralItems(300, val => val.Key%3 == 0));
			Assert.IsFalse(dict.HasSeveralItems(1025, val => val.Key%3 == 0));
        }
开发者ID:Pzixel,项目名称:ZLinq,代码行数:19,代码来源:HasSeveralItems.cs

示例2: HasSeveralItemsArray

        public void HasSeveralItemsArray()
        {
            var x = Enumerable.Range(1, 1024).ToArray();
            var y = Enumerable.Range(1, 1024).Select(a => new Tuple<int, int>(a,a)).ToArray();
            var z = Enumerable.Range(1, 1024).Select(a => new { A = a}).ToArray();
            var dict = new SortedDictionary<int, int>(x.ToDictionary(a => a, a => a));

            Assert.IsTrue(x.HasSeveralItems(10));
			Assert.IsTrue(x.HasSeveralItems(1000));
			Assert.IsFalse(x.HasSeveralItems(1025));			
			Assert.IsTrue(y.HasSeveralItems(10));
			Assert.IsTrue(y.HasSeveralItems(1000));
			Assert.IsFalse(y.HasSeveralItems(1025));
			Assert.IsTrue(z.HasSeveralItems(10));
			Assert.IsTrue(z.HasSeveralItems(1000));
			Assert.IsFalse(z.HasSeveralItems(1025));
			Assert.IsTrue(dict.HasSeveralItems(10));
			Assert.IsTrue(dict.HasSeveralItems(1000));
			Assert.IsFalse(dict.HasSeveralItems(1025));
        }
开发者ID:Pzixel,项目名称:ZLinq,代码行数:20,代码来源:HasSeveralItems.cs


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