當前位置: 首頁>>代碼示例>>C#>>正文


C# Point.GetHashCode方法代碼示例

本文整理匯總了C#中System.Point.GetHashCode方法的典型用法代碼示例。如果您正苦於以下問題:C# Point.GetHashCode方法的具體用法?C# Point.GetHashCode怎麽用?C# Point.GetHashCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Point的用法示例。


在下文中一共展示了Point.GetHashCode方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Add

 public void Add(Point p, int value)
 {
     if (slotValues[p.GetHashCode()] == 0)
     {
         slotValues[p.GetHashCode()] = value;
         indexedSlot.Add(p.GetHashCode());
     }
 }
開發者ID:analyst74,項目名稱:aichallenge-tron,代碼行數:8,代碼來源:IndexedPointHash.cs

示例2: Contains

 public bool Contains(Point p)
 {
     if (slotValues[p.GetHashCode()] == 0)
         return false;
     else
         return true;
 }
開發者ID:analyst74,項目名稱:aichallenge-tron,代碼行數:7,代碼來源:IndexedPointHash.cs

示例3:

 public int this[Point p]
 {
     get
     {
         return slotValues[p.GetHashCode()];
     }
 }
開發者ID:analyst74,項目名稱:aichallenge-tron,代碼行數:7,代碼來源:IndexedPointHash.cs

示例4: Point

		public void Point()
		{
			//Do various Point method calls to cover the point class with sufficient testing
			Point p0 = new Point();
			Point p1 = new Point(0,0);
			Point p2 = new Point(450, 120);
			Assert.IsTrue(p0.IsEmpty());
			Assert.IsFalse(p1.IsEmpty());
			Assert.AreNotEqual(p0, p1);
			Assert.AreEqual(450, p2.X);
			Assert.AreEqual(120, p2.Y);
			Assert.AreNotSame(p2.Clone(), p2);
			p0 = p2.Clone();
			p0.X += 100; p0.Y = 150;
			p0[0] += p0[1];
			Assert.AreEqual(new Point(700, 150),p0);
			Assert.AreEqual(p2, p2.GetBoundingBox().Min);
			Assert.AreEqual(p2, p2.GetBoundingBox().Max);
			Assert.IsTrue(p2.IsSimple());
			Assert.IsFalse(p2.IsEmpty());
			Assert.AreEqual(2, p2.NumOrdinates);
			Assert.AreEqual(new Point(400, 100), p2 + new Point(-50, -20));
			Assert.AreEqual(new Point(500, 100), p2 - new Point(-50, 20));
			Assert.AreEqual(new Point(900, 240), p2 * 2);
			Assert.AreEqual(0, p2.Dimension);
			Assert.AreEqual(450, p2[0]);
			Assert.AreEqual(120, p2[1]);
			Assert.IsNull(p2.Boundary());
			Assert.AreEqual(p2.X.GetHashCode() ^ p2.Y.GetHashCode() ^ p2.IsEmpty().GetHashCode(), p2.GetHashCode());
			Assert.Greater(p2.CompareTo(p1), 0);
			Assert.Less(p1.CompareTo(p2), 0);
			Assert.AreEqual(p2.CompareTo(new Point(450,120)), 0);
		}
開發者ID:lishxi,項目名稱:_SharpMap,代碼行數:33,代碼來源:PointTests.cs

示例5: TestHashCode

        public void TestHashCode()
        {
            int x = 2;
            int y = 4;
            var p = new Point(x, y);

            Assert.AreEqual(x ^ y, p.GetHashCode());
        }
開發者ID:mattmemmesheimer,項目名稱:minesearch-reboot,代碼行數:8,代碼來源:PointTest.cs

示例6: Remove

 public void Remove(Point p)
 {
     slotValues[p.GetHashCode()] = 0;
     indexedSlot.Remove(p.GetHashCode());
 }
開發者ID:analyst74,項目名稱:aichallenge-tron,代碼行數:5,代碼來源:IndexedPointHash.cs

示例7: CompareHashes

 public void CompareHashes(Point a, Point b, bool result)
 {
     (a.GetHashCode() == b.GetHashCode()).Should().Be(result);
 }
開發者ID:WinstonSmith77,項目名稱:vertrackt,代碼行數:4,代碼來源:PointTest.cs


注:本文中的System.Point.GetHashCode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。