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


C# Point.GetHashCode方法代码示例

本文整理汇总了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());
        }
开发者ID:nobled,项目名称:mono,代码行数:9,代码来源:PointTest.cs

示例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.
开发者ID:samgonzalezr,项目名称:WPFSamples,代码行数:66,代码来源:MainWindow.xaml.cs


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