示例#1
0
        static void Main(string[] args)
        {
            object[] pairs = { 1, 2, 3, 4, 5 };
            object[] anotherPairs = { "aa", "bb" };

            Pair<int, int> pair = new Pair<int, int>(1,2);
            Pair<int, int> anotherPair = new Pair<int, int>(1, 2);
            Console.WriteLine(pair.ToString());
            Console.WriteLine(pair.Equals(anotherPair));
        }
        static void Main(string[] args)
        {
            Pair p = new Pair(2, 3);
            Pair p1 = new Pair(4, 5);
            Pair p2 = new Pair(2, 3);

            Console.WriteLine(p.ToString());
            Console.WriteLine(p.Equals(p1));

            if (p == p2)
            {
                Console.WriteLine(true);
            }

            else
            {
                Console.WriteLine(false);
            }
        }