Esempio n. 1
0
 private void Add(string key, IGenericInstance value)
 {
     GenericInstanceHolder holder;
     if (this._context.TryGetValue(key, out holder))
     {
         MemberReference reference = value as MemberReference;
         if (reference == null)
         {
             throw new NotSupportedException();
         }
         MemberReference genericInstance = (MemberReference) holder.GenericInstance;
         if (genericInstance.FullName != reference.FullName)
         {
             throw new ArgumentException("Duplicate key!", "key");
         }
         holder.Count++;
     }
     else
     {
         GenericInstanceHolder holder2 = new GenericInstanceHolder {
             Count = 1,
             GenericInstance = value
         };
         this._context.Add(key, holder2);
     }
 }
Esempio n. 2
0
        private void Add(string key, IGenericInstance value)
        {
            GenericInstanceHolder holder;

            if (this._context.TryGetValue(key, out holder))
            {
                MemberReference reference = value as MemberReference;
                if (reference == null)
                {
                    throw new NotSupportedException();
                }
                MemberReference genericInstance = (MemberReference)holder.GenericInstance;
                if (genericInstance.FullName != reference.FullName)
                {
                    throw new ArgumentException("Duplicate key!", "key");
                }
                holder.Count++;
            }
            else
            {
                GenericInstanceHolder holder2 = new GenericInstanceHolder {
                    Count           = 1,
                    GenericInstance = value
                };
                this._context.Add(key, holder2);
            }
        }