Ejemplo n.º 1
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, obj))
            {
                return(true);
            }

            MultplePrimKey otherKey = (obj as MultplePrimKey);

            if ((otherKey != null) && (otherKey.Key1 == this.Key1) && (otherKey.Key2 == Key2))
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        static void test13()
        {
            Dictionary <MultplePrimKey, int> dic = new Dictionary <MultplePrimKey, int>();
            MultplePrimKey key = new MultplePrimKey();

            key.Key1 = "A";
            key.Key2 = "B";
            dic.Add(key, 2);
            key      = new MultplePrimKey();
            key.Key1 = "A";
            key.Key2 = "C";
            dic.Add(key, 12);
            key      = new MultplePrimKey();
            key.Key1 = "A";
            key.Key2 = "D";
            dic.Add(key, 3);
            key      = new MultplePrimKey();
            key.Key1 = "C";
            key.Key2 = "B";
            dic.Add(key, 5);
            key      = new MultplePrimKey();
            key.Key1 = "D";
            key.Key2 = "B";
            dic.Add(key, 2);
            key      = new MultplePrimKey();
            key.Key1 = "C";
            key.Key2 = "D";
            dic.Add(key, 32);


            MultplePrimKey testkey = new MultplePrimKey();

            testkey.Key1 = "C";
            testkey.Key2 = "D";

            Console.WriteLine(dic[testkey].ToString());
        }
Ejemplo n.º 3
0
        static void test13()
        {
            Dictionary<MultplePrimKey, int> dic = new Dictionary<MultplePrimKey, int>();
            MultplePrimKey key = new MultplePrimKey();
            key.Key1 = "A";
            key.Key2 = "B";
            dic.Add(key, 2);
            key = new MultplePrimKey();
            key.Key1 = "A";
            key.Key2 = "C";
            dic.Add(key, 12);
            key = new MultplePrimKey();
            key.Key1 = "A";
            key.Key2 = "D";
            dic.Add(key, 3);
            key = new MultplePrimKey();
            key.Key1 = "C";
            key.Key2 = "B";
            dic.Add(key, 5);
            key = new MultplePrimKey();
            key.Key1 = "D";
            key.Key2 = "B";
            dic.Add(key, 2);
            key = new MultplePrimKey();
            key.Key1 = "C";
            key.Key2 = "D";
            dic.Add(key, 32);

            MultplePrimKey testkey = new MultplePrimKey();
            testkey.Key1 = "C";
            testkey.Key2 = "D";

            Console.WriteLine(dic[testkey].ToString());
        }