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


C# Vector.GetHashCode方法代码示例

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


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

示例1: equal_vectors_have_equal_hashcodes

    public void equal_vectors_have_equal_hashcodes()
    {
      var v1 = new Vector<int>(new int[] { 1, 2, 3 }, Orientation.Row
        , AdditiveMonoid.IntAdditionMonoid, MultiplicativeMonoid.IntMultiplicationMonoid);
      var v2 = new Vector<int>(new int[] { 1, 2, 3 }, Orientation.Row
        , AdditiveMonoid.IntAdditionMonoid, MultiplicativeMonoid.IntMultiplicationMonoid);

      Assert.IsTrue(v1 == v2);
      Assert.That(v1.GetHashCode(), Is.EqualTo(v2.GetHashCode()));
    }
开发者ID:JoeDumoulin,项目名称:Algebraic.Net,代码行数:10,代码来源:VectorTests.cs

示例2: TestEquals

        public void TestEquals()
        {
            Vector vector1 = new Vector(1.0, 2.0, 3.0);
            Vector vector2 = new Vector(1.0, 2.0, 3.0);

            Assert.That(vector1, Is.Not.SameAs(vector2));
            Assert.That(vector1, Is.EqualTo(vector2));
            Assert.False(vector1.Equals(null));
            Assert.That(vector1.GetHashCode(), Is.EqualTo(vector2.GetHashCode()));

            vector2.Altitude = null;
            Assert.That(vector1, Is.Not.EqualTo(vector2));

            vector2.Altitude = 3.0;
            vector2.Latitude = 3.0;
            Assert.That(vector1, Is.Not.EqualTo(vector2));
        }
开发者ID:karun10,项目名称:KML2SQL,代码行数:17,代码来源:VectorTest.cs

示例3: Main

        static void Main()
        {
            var vect1 = new Vector(3.0, 3.0, -10.0);
            var vect2 = new Vector(3.0, 3.0, -10.0);
            var vect3 = new Vector(2.0, 3.0, 6.0);

            WriteLine($"vect1 == vect2 returns {(vect1 == vect2)}");
            WriteLine($"vect1 == vect3 returns {(vect1 == vect3)}");
            WriteLine($"vect2 == vect3 returns {(vect2 == vect3)}");

            WriteLine();

            WriteLine($"vect1 != vect2 returns {(vect1 != vect2)}");
            WriteLine($"vect1 != vect3 returns {(vect1 != vect3)}");
            WriteLine($"vect2 != vect3 returns {(vect2 != vect3)}");

            var vect4 = new Vector(5.0, 2.0, 0);
            var vect5 = new Vector(2.0, 5.0, 0);
            WriteLine(vect4.GetHashCode());
            WriteLine(vect5.GetHashCode());
        }
开发者ID:ProfessionalCSharp,项目名称:ProfessionalCSharp6,代码行数:21,代码来源:Program.cs

示例4: EqualsAndHashCode

        public void EqualsAndHashCode()
        {
            Vector vector1 = new Vector(new double[] { 1.0, 2.0, 3.0 });
            Vector vector2 = new Vector(new double[] { 1.0, 2.0, 3.0 });
            Vector vector3 = new Vector(new double[] { 1.0, 2.0, 3.0, 4.0 });
            Vector vector4 = new Vector(new double[] { 1.0, 2.0, 4.0 });

            Assert.IsTrue(vector1.Equals(vector2));
            Assert.IsTrue(vector2.Equals(vector1));

            Assert.AreEqual(vector2.GetHashCode(), vector1.GetHashCode());

            Assert.IsFalse(vector1.Equals(vector3));
            Assert.IsFalse(vector1.Equals(vector4));
            Assert.IsFalse(vector3.Equals(vector1));
            Assert.IsFalse(vector4.Equals(vector1));

            Assert.IsFalse(vector1.Equals(null));
            Assert.IsFalse(vector1.Equals(42));
            Assert.IsFalse(vector1.Equals("foo"));
        }
开发者ID:ajlopez,项目名称:MathelSharp,代码行数:21,代码来源:VectorTests.cs

示例5: TestVectorHashcode

 public void TestVectorHashcode()
 {
     var v = new Vector<string, int> { { "x", 1 }, { "y", -2 } };
     // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
     v.GetHashCode();
 }
开发者ID:drbatty,项目名称:maths-core,代码行数:6,代码来源:VectorTests.cs

示例6: Vector_GetHashCode_returns_same_hash_for_same_object

 public void Vector_GetHashCode_returns_same_hash_for_same_object()
 {
     var v1 = new Vector(1.0f, 1.2f, 1.9f);
       var v2 = v1;
       var hash1 = v1.GetHashCode();
       var hash2 = v2.GetHashCode();
       Assert.AreEqual(hash1, hash2);
 }
开发者ID:EddPorter,项目名称:RayManCS,代码行数:8,代码来源:VectorTests.cs

示例7: Vector_GetHashCode_returns_different_hashes_for_different_objects

 public void Vector_GetHashCode_returns_different_hashes_for_different_objects()
 {
     var v1 = new Vector(1.0f, 1.2f, 1.9f);
       var v2 = new Vector(-1.0f, -1.2f, -1.9f);
       var hash1 = v1.GetHashCode();
       var hash2 = v2.GetHashCode();
       Assert.AreNotEqual(hash1, hash2);
 }
开发者ID:EddPorter,项目名称:RayManCS,代码行数:8,代码来源:VectorTests.cs

示例8: Vector_GetHashCode_returns

 public void Vector_GetHashCode_returns()
 {
     var v = new Vector(1.0f, 1.2f, 1.9f);
       v.GetHashCode();
 }
开发者ID:EddPorter,项目名称:RayManCS,代码行数:5,代码来源:VectorTests.cs


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