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


C# Location.GetHashCode方法代码示例

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


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

示例1: TestEquals

 public void TestEquals()
 {
   var loc1 = new Location(1, 2);
   var loc2 = new Location(1, 2);
   var loc3 = new Location(1, 3);
   Assert.AreEqual(loc1, loc2);
   Assert.AreEqual(loc1.GetHashCode(), loc2.GetHashCode());
   Assert.AreNotEqual(loc1, loc3);
   Assert.AreNotEqual(loc1.GetHashCode(), loc3.GetHashCode());
 }
开发者ID:shengqh,项目名称:CQS.Test,代码行数:10,代码来源:TestLocation.cs

示例2: locationXYRegionHandle

        public void locationXYRegionHandle()
        {
            Location TestLocation1 = new Location(256000,256000);
            Location TestLocation2 = new Location(1099511628032000);
            Assert.That(TestLocation1 == TestLocation2);

            Assert.That(TestLocation2.X == 256000 && TestLocation2.Y == 256000, "Test xy location doesn't match regionhandle provided");

            Assert.That(TestLocation2.RegionHandle == 1099511628032000,
                        "Location RegionHandle Property didn't match regionhandle provided in constructor");


            TestLocation1 = new Location(256001, 256001);
            TestLocation2 = new Location(1099511628032000);
            Assert.That(TestLocation1 != TestLocation2);

            Assert.That(TestLocation1.Equals(256001, 256001), "Equals(x,y) failed to match the position in the constructor");

            Assert.That(TestLocation2.GetHashCode() == (TestLocation2.X.GetHashCode() ^ TestLocation2.Y.GetHashCode()), "GetHashCode failed to produce the expected hashcode");

            Location TestLocation3;
            object cln = TestLocation2.Clone();
            TestLocation3 = (Location) cln;
            Assert.That(TestLocation3.X == TestLocation2.X && TestLocation3.Y == TestLocation2.Y,
                        "Cloned Location values do not match");

            Assert.That(TestLocation2.Equals(cln), "Cloned object failed .Equals(obj) Test");

        }
开发者ID:justasabc,项目名称:opensim75,代码行数:29,代码来源:LocationTest.cs

示例3: CanCompareForEquality

		public void CanCompareForEquality()
		{
			Location loc1 = new Location(85.6789, 92.4517);
			Location loc2 = new Location(85.6789, 92.4517);

			Assert.True(loc1.Equals(loc2));
			Assert.Equal(loc1.GetHashCode(), loc2.GetHashCode());
		}
开发者ID:Virtualhurst,项目名称:Geocoding.net,代码行数:8,代码来源:LocationTest.cs


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