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


C# KeyValuePair.SequenceEqual方法代码示例

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


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

示例1: RestoreSnapshot

 public static Expression RestoreSnapshot(KeyValuePair<string, List<Type>>[] SnapshotData)
 {
     if (SnapshotData.SequenceEqual(CurrentScope.OnDateType)) return null;
     var Ret = Expression.Block(
         SnapshotData.Except(CurrentScope.OnDateType)
         .SelectMany(x => x.Value.Select(y => CurrentScope.GetVarCached(x.Key, y)))
     );
     SnapshotData = null;
     return Ret;
 }
开发者ID:nem-e5i5,项目名称:Autolithium.core,代码行数:10,代码来源:VarAutExpressionBeam.cs

示例2: FrequencyTest2

        public void FrequencyTest2() {
            var input = new int[]
                        {
                            1, 2, 3, 4, 3, 2, 3, 3, 3, 3, 2, 2, 2, 3, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, 3,
                            3, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2
                        };
            Func<int, string> bucketSelector = X => X <= 2 ? "2 and under" : "Over 2";

            var expected = new KeyValuePair<string, int>[]
                           { new KeyValuePair<string, int>("2 and under", 36), new KeyValuePair<string, int>("Over 2", 13) };
            var actual = input.Frequency(bucketSelector);

            if(IsDebugEnabled)
                log.Debug(@"expected=[{0}], actual=[{1}]", expected.CollectionToString(), actual.CollectionToString());

            Assert.IsTrue(expected.SequenceEqual(actual));
        }
开发者ID:debop,项目名称:NFramework,代码行数:17,代码来源:MathToolFixture.Probability.cs

示例3: FrequencyTest1

        public void FrequencyTest1() {
            var input = new int[]
                        {
                            1, 2, 3, 4, 3, 2, 3, 3, 3, 3, 2, 2, 2, 3, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, 3,
                            3, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2
                        };
            var expected = new KeyValuePair<int, int>[]
                           {
                               new KeyValuePair<int, int>(1, 13),
                               new KeyValuePair<int, int>(2, 23),
                               new KeyValuePair<int, int>(3, 12),
                               new KeyValuePair<int, int>(4, 1)
                           };
            var actual = input.Frequency();

            if(IsDebugEnabled)
                log.Debug(@"expected=[{0}], actual=[{1}]", expected.CollectionToString(), actual.CollectionToString());

            Assert.IsTrue(expected.SequenceEqual(actual));
        }
开发者ID:debop,项目名称:NFramework,代码行数:20,代码来源:MathToolFixture.Probability.cs

示例4: FrequencyTest3

        public void FrequencyTest3() {
            var input = new int[]
                        {
                            1, 2, 3, 4, 3, 2, 3, 3, 3, 3, 2, 2, 2, 3, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, 3,
                            3, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2
                        };
            var buckets = new string[] { "a", "b", "c", "Z1", "Z2" };
            Func<int, IEnumerable<string>, string> bucketSelector = BucketSelector;
            var expected = new KeyValuePair<string, int>[]
                           {
                               new KeyValuePair<string, int>("a", 13),
                               new KeyValuePair<string, int>("b", 23),
                               new KeyValuePair<string, int>("c", 12),
                               new KeyValuePair<string, int>("Z1", 1),
                               new KeyValuePair<string, int>("Z2", 0)
                           };
            var actual = MathTool.Frequency(input, buckets, bucketSelector);

            if(IsDebugEnabled)
                log.Debug(@"expected=[{0}], actual=[{1}]", expected.CollectionToString(), actual.CollectionToString());

            Assert.IsTrue(expected.SequenceEqual(actual));
        }
开发者ID:debop,项目名称:NFramework,代码行数:23,代码来源:MathToolFixture.Probability.cs

示例5: CopyTo

        public void CopyTo()
        {
            IDictionary<string, string> dict = new Dictionary<string, string>();
            dict.Add("Key", "Value");
            dict.Add("OtherKey", "OtherValue");

            dict = dict.ToReadOnlyDictionary();

            var values = new KeyValuePair<string, string>[3];

            var expectedValues = new[]
            {
                KeyValuePair.Create("Key", "Value"),
                KeyValuePair.Create("OtherKey", "OtherValue"),
                default(KeyValuePair<string, string>)
            };

            dict.CopyTo(values, 0);
            Assert.IsTrue(values.SequenceEqual(expectedValues));

            dict.CopyTo(values, 1);

            expectedValues[2] = expectedValues[1];
            expectedValues[1] = expectedValues[0];

            Assert.IsTrue(values.SequenceEqual(expectedValues));
        }
开发者ID:jiguixin,项目名称:iSynaptic.Commons,代码行数:27,代码来源:ReadOnlyDictionaryTests.cs


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