예제 #1
0
        public TItem this[TKey key]
        {
            get
            {
                if (key == null)
                {
                    ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
                }

                if (dict != null)
                {
                    return(dict[key]);
                }

                foreach (TItem item in Items)
                {
                    if (comparer.Equals(GetKeyForItem(item), key))
                    {
                        return(item);
                    }
                }

                ThrowHelper.ThrowKeyNotFoundException();
                return(default(TItem));
            }
        }
예제 #2
0
 public TItem this[TKey key]
 {
     [__DynamicallyInvokable] get
     {
         if ((object)key == null)
         {
             ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
         }
         if (this.dict != null)
         {
             return(this.dict[key]);
         }
         foreach (TItem obj in (IEnumerable <TItem>) this.Items)
         {
             if (this.comparer.Equals(this.GetKeyForItem(obj), key))
             {
                 return(obj);
             }
         }
         ThrowHelper.ThrowKeyNotFoundException();
         return(default(TItem));
     }
 }
예제 #3
0
 public TItem this[TKey key]
 {
     get
     {
         if (key == null)
         {
             ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
         }
         if (this.dict != null)
         {
             return(this.dict[key]);
         }
         foreach (TItem local in base.Items)
         {
             if (this.comparer.Equals(this.GetKeyForItem(local), key))
             {
                 return(local);
             }
         }
         ThrowHelper.ThrowKeyNotFoundException();
         return(default(TItem));
     }
 }