本文整理汇总了C#中System.Windows.Point.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# Point.GetHashCode方法的具体用法?C# Point.GetHashCode怎么用?C# Point.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Point
的用法示例。
在下文中一共展示了Point.GetHashCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getHashCodeTest
public void getHashCodeTest()
{
Point p1 = new Point(-5, -4);
Point p2 = new Point(5, 4);
Point p3 = new Point(5, 4);
Assert.AreEqual(p2.GetHashCode(), p3.GetHashCode());
Assert.AreEqual(p1.GetHashCode(),p2.GetHashCode());
}
示例2: PerformOperation
//.........这里部分代码省略.........
pointResult = Point.Parse("1,3");
// pointResult is equal to (1, 3)
// Displaying Results
syntaxString = "pointResult = Point.Parse(\"1,3\");";
resultType = "Matrix";
operationString = "Converts a string into a Point structure.";
ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb15":
{
// Gets a string representation of a Point structure
Point point1 = new Point(10, 5);
String pointString;
pointString = point1.ToString();
// pointString is equal to 10,5
// Displaying Results
syntaxString = "pointString = point1.ToString();";
resultType = "String";
operationString = "Getting the string representation of a Point";
ShowResults(pointString.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb16":
{
// Gets the hashcode of a Point structure
Point point1 = new Point(10, 5);
int pointHashCode;
pointHashCode = point1.GetHashCode();
// Displaying Results
syntaxString = "pointHashCode = point1.GetHashCode();";
resultType = "int";
operationString = "Getting the hashcode of Point";
ShowResults(pointHashCode.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb17":
{
// Explicitly converts a Point structure into a Size structure
// Returns a Size.
Point point1 = new Point(10, 5);
Size size1 = new Size();
size1 = (Size)point1;
// size1 has a width of 10 and a height of 5
// Displaying Results
syntaxString = "size1 = (Size)point1;";
resultType = "Size";
operationString = "Expliciting casting a Point into a Size";
ShowResults(size1.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb18":
{
// Explicitly converts a Point structure into a Vector structure
// Returns a Vector.