예제 #1
0
        public MyDictionary Subtraction(MyDictionary dictionary, string newDictionaryName)
        {
            MyDictionary newDictionary = new MyDictionary(newDictionaryName);
            var          keys          = this.dictionary.Keys;

            foreach (var key in keys)
            {
                string tempValue = this.dictionary[key];
                if (!dictionary.ContainsKey(key) && !dictionary.ContainsValue(tempValue))
                {
                    newDictionary.Add(key, tempValue);
                }
            }

            keys = dictionary.dictionary.Keys;
            foreach (var key in keys)
            {
                string tempValue = dictionary.dictionary[key];
                if (!this.dictionary.ContainsKey(key) && !this.dictionary.ContainsValue(tempValue))
                {
                    newDictionary.Add(key, tempValue);
                }
            }

            return(newDictionary);
        }
예제 #2
0
        public MyDictionary Crossing(MyDictionary dictionary, string newDictionaryName)
        {
            MyDictionary newDictionary = new MyDictionary(newDictionaryName);
            var          keys          = this.dictionary.Keys;

            foreach (var key in keys)
            {
                string tempValue = this.dictionary[key];
                if (dictionary.ContainsKey(key) && dictionary.Search(key).Equals(tempValue))
                {
                    newDictionary.Add(key, tempValue);
                }
            }

            return(newDictionary);
        }