Beispiel #1
0
        public override bool Equals(object obj)
        {
            GetHashCodeTest gct = obj as GetHashCodeTest;

            //if(gct.X == this.X && gct.Y == this.Y)
            //{
            //    return true;
            //}
            if (this.GetHashCode() == gct.GetHashCode())
            {
                return(true);
            }

            return(false);
        }
Beispiel #2
0
        private static void Test4()
        {
            var obj1 = new GetHashCodeTest()
            {
                X = 1,
                Y = 2
            };

            var obj2 = new GetHashCodeTest()
            {
                X = 1,
                Y = 2
            };

            Console.WriteLine(obj1.Equals(obj2));
        }