Beispiel #1
0
        static void Main(string[] args)
        {
            // Points
            Point a = new Point(2, 3);
            Point b = new Point(3, 2);
            Point c = new Point(4, 4);

            // Hashes
            Console.WriteLine("Point {0}, Hash = {1}", a, a.GetHashCode());
            Console.WriteLine("Point {0}, Hash = {1}", b, b.GetHashCode());
            Console.WriteLine("Point {0}, Hash = {1}", c, c.GetHashCode());
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            // Създаваме три обекта инстанции на класа
            Point a = new Point(2, 3);
            Point b = new Point(3, 2);
            Point c = new Point(4, 4);

            // Калкулираме и отпечатваме хеш на обектите
            Console.WriteLine("Point {0}, Hash = {1}", a.ToString(), a.GetHashCode());
            Console.WriteLine("Point {0}, Hash = {1}", b.ToString(), b.GetHashCode());
            Console.WriteLine("Point {0}, Hash = {1}", c.ToString(), c.GetHashCode());
        }