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


C# Tuple.GetHashCode方法代码示例

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


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

示例1: GetHashCodeIsTheSame

        public void GetHashCodeIsTheSame()
        {
            var sut2 = new Tuple<int, string>(integer, stringy);

            Assert.Equal(sut2.GetHashCode(), sut.GetHashCode());
        }
开发者ID:dahlbyk,项目名称:libgit2sharp,代码行数:6,代码来源:TupleFixture.cs

示例2: Value_type_tuple

		public void Value_type_tuple()
		{
			// This is a bit contrived, just need an easy class (ie non-value type)
			var helper = new IdHelperForClassType<Tuple<int, int>>();

			var tuple1 = new Tuple<int, int>(1, 2);
			var tuple2 = new Tuple<int, int>(1, 3);

			var tuple1Again = new Tuple<int, int>(1, 2);

			Assert.AreEqual(true, helper.IsNull(null));
			Assert.AreEqual(true, helper.IsDefaultValue(null));
			Assert.AreEqual(false, helper.IsDefaultValue(tuple1));
			Assert.AreEqual(true, helper.AreEqual(null, null));
			Assert.AreEqual(true, helper.AreEqual(tuple1, tuple1Again));
			Assert.AreEqual(-1, helper.Compare(null, tuple1));
			Assert.AreEqual(-1, helper.Compare(tuple1, tuple2));
			Assert.AreEqual(+1, helper.Compare(tuple2, null));
			Assert.AreEqual(+1, helper.Compare(tuple2, tuple1));
			Assert.That(helper.Compare(null, null), Is.EqualTo(0));
			Assert.AreEqual(0, helper.Compare(tuple1, tuple1Again));
			Assert.AreEqual(tuple1.GetHashCode(), helper.GetHashCode(tuple1));
			Assert.AreEqual(0, helper.GetHashCode(null));
		}
开发者ID:matthewc-mps-aust,项目名称:quokka,代码行数:24,代码来源:IdHelperTests.cs

示例3: CanHashCodeTwoFiveSizedNullableTuples

        public void CanHashCodeTwoFiveSizedNullableTuples()
        {
            var tuple1 = new Tuple<int?>(1, 2, null, 4, 5);
            var tuple2 = new Tuple<int?>(1, 2, null, 4, 5);
            var tuple3 = new Tuple<int?>(1, 2, 3, 4, null);

            tuple2.GetHashCode().Should().Be(tuple1.GetHashCode());
            tuple3.GetHashCode().Should().Not.Be(tuple1.GetHashCode());
        }
开发者ID:Trovarius,项目名称:simple,代码行数:9,代码来源:TuplesFixture.cs

示例4: GetHashCodeIsDifferent

        public void GetHashCodeIsDifferent()
        {
            var sut2 = new Tuple<int, string>(integer + 1, stringy);

            Assert.NotEqual(sut2.GetHashCode(), sut.GetHashCode());
        }
开发者ID:dahlbyk,项目名称:libgit2sharp,代码行数:6,代码来源:TupleFixture.cs

示例5: CannotHashCodeTwoDifferentSizesTuples

        public void CannotHashCodeTwoDifferentSizesTuples()
        {
            var tuple1 = new Tuple<int>(1, 2, 3, 4, 5);
            var tuple2 = new Tuple<int>(1, 2, 3, 4, 5, 6);

            tuple2.GetHashCode().Should().Not.Be(tuple1.GetHashCode());
        }
开发者ID:Trovarius,项目名称:simple,代码行数:7,代码来源:TuplesFixture.cs

示例6: CanHashCodeTwoFiveSizedTuples

        public void CanHashCodeTwoFiveSizedTuples()
        {
            var tuple1 = new Tuple<int>(1, 2, 3, 4, 5);
            var tuple2 = new Tuple<int>(1, 2, 3, 4, 5);
            var tuple3 = new Tuple<int>(1, 2, 3, 4, 6);

            tuple2.GetHashCode().Should().Be(tuple1.GetHashCode());
            tuple3.GetHashCode().Should().Not.Be(tuple1.GetHashCode());
        }
开发者ID:Trovarius,项目名称:simple,代码行数:9,代码来源:TuplesFixture.cs

示例7: GetHashCodeIsTheSame

        public void GetHashCodeIsTheSame()
        {
            var sut2 = new Tuple<int, string>(integer, stringy);

            sut.GetHashCode().ShouldEqual(sut2.GetHashCode());
        }
开发者ID:redoz,项目名称:libgit2sharp,代码行数:6,代码来源:TupleFixture.cs

示例8: GetHashCode

 public static int GetHashCode(Tuple<string, string> fromStatusSubStatus, Tuple<string, string> toStatusSubStatus)
 {
     return (fromStatusSubStatus.GetHashCode() << 8) + toStatusSubStatus.GetHashCode();
 }
开发者ID:ashishquovantis,项目名称:esqcd,代码行数:4,代码来源:Transition.cs

示例9: GetHashCode

 public override int GetHashCode()
 {
     var tuple = new Tuple<string, string> (Id, Destination);
     return tuple.GetHashCode ();
 }
开发者ID:hakonfjukstad,项目名称:Avgangsalarm,代码行数:5,代码来源:Line.cs


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