Esempio n. 1
0
        public TValue this[TKey key]
        {
            get
            {
                if (key == null)
                {
                    throw new ArgumentNullException(nameof(key));
                }

                KeyValuePair <TKey, TValue> foundValue;
                var found = _root.TryFind(KeyPair(key), _comparer, out foundValue);

                if (!found)
                {
                    throw ExceptionHelper.GetKeyNotFoundException(key);
                }

                return(foundValue.Value);
            }
        }
Esempio n. 2
0
        public bool Contains(T item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            T foundItem;

            return(_root.TryFind(item, _comparer, out foundItem));
        }