Example #1
0
		public void GetSet ()
		{
			TypeElement el = new TypeElement ();

			el.Type = typeof (string);
			Assert.AreEqual (typeof (string), el.Type, "A1");
		}
 public void Remove(TypeElement element)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     base.BaseRemove(this.GetElementKey(element));
 }
 public int IndexOf(TypeElement element)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     return(base.BaseIndexOf(element));
 }
 public void Add(TypeElement element)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     this.BaseAdd(element);
 }
        public void Add(TypeElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            BaseAdd(element);
        }
        public void CopyTo(TypeElement[] array, int index)
        {
            if (array == null)
            {
                throw new ArgumentNullException("array");
            }

            ((ICollection)this).CopyTo(array, index);
        }
        public int IndexOf(TypeElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            return BaseIndexOf(element);
        }
        public void Remove(TypeElement element) 
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            BaseRemove(GetElementKey(element));
        }
        protected override object GetElementKey(ConfigurationElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }
            TypeElement element2 = (TypeElement)element;

            return(element2.Type);
        }
Example #10
0
		public void Ctors2 ()
		{
			TypeElement el;

			el = new TypeElement (typeof (string));
			Assert.AreEqual (typeof (string), el.Type, "A2");

			el = new TypeElement ("System.String");
			Assert.AreEqual (typeof (string), el.Type, "A3");
		}
Example #11
0
 public TypeElement this [object key] {
     get { return((TypeElement)BaseGet(key)); }
     set {
         TypeElement el = (TypeElement)BaseGet(key);
         if (el == null)
         {
             BaseAdd(value);
             return;
         }
         int index = IndexOf(el);
         BaseRemoveAt(index);
         BaseAdd(index, value);
     }
 }
Example #12
0
 public TypeElement this[object key]
 {
     get
     {
         if (key == null)
         {
             throw new ArgumentNullException("key");
         }
         TypeElement retval = (TypeElement)this.BaseGet(key);
         if (retval == null)
         {
             throw new System.Collections.Generic.KeyNotFoundException(
                       string.Format(CultureInfo.InvariantCulture,
                                     Res.GetString(Res.ConfigKeyNotFoundInElementCollection),
                                     key.ToString()));
         }
         return(retval);
     }
     set
     {
         if (value == null)
         {
             throw new ArgumentNullException("value");
         }
         if (key == null)
         {
             throw new ArgumentNullException("key");
         }
         // NOTE [ivelin : integration fix] The change bellow have the issue that it wont use the collection comparer
         // if one is specified. We ( System.Configuration ) usually avoid having set_item[ key ] when the element contains
         // the key and instead provide an Add( element ) method only.
         if (this.GetElementKey(value).Equals(key))
         {
             if (BaseGet(key) != null)
             {
                 BaseRemove(key);
             }
             Add(value);
         }
         else
         {
             throw new ArgumentException(string.Format(CultureInfo.InvariantCulture,
                                                       Res.GetString(Res.ConfigKeysDoNotMatch), this.GetElementKey(value).ToString(),
                                                       key.ToString()));
         }
     }
 }
 public TypeElement this[object key]
 {
     get
     {
         if (key == null)
         {
             throw new ArgumentNullException("key");
         }
         TypeElement element = (TypeElement)base.BaseGet(key);
         if (element == null)
         {
             throw new KeyNotFoundException(string.Format(CultureInfo.InvariantCulture, Res.GetString("ConfigKeyNotFoundInElementCollection"), new object[] { key.ToString() }));
         }
         return(element);
     }
     set
     {
         if (value == null)
         {
             throw new ArgumentNullException("value");
         }
         if (key == null)
         {
             throw new ArgumentNullException("key");
         }
         if (!this.GetElementKey(value).Equals(key))
         {
             throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, Res.GetString("ConfigKeysDoNotMatch"), new object[] { this.GetElementKey(value).ToString(), key.ToString() }));
         }
         if (base.BaseGet(key) != null)
         {
             base.BaseRemove(key);
         }
         this.Add(value);
     }
 }
Example #14
0
		public int IndexOf (TypeElement element)
		{
			return BaseIndexOf (element);
		}
 public void Remove(TypeElement element)
 {
     BaseRemove(element.Type);
 }
 public int IndexOf(TypeElement element)
 {
     return(BaseIndexOf(element));
 }
 public void Add(TypeElement element)
 {
     BaseAdd(element);
 }
Example #18
0
		public void Ctors1 ()
		{
			TypeElement el = new TypeElement ();
			Assert.IsNull (el.Type, "A1");
		}
Example #19
0
		public void Add (TypeElement element)
		{
			BaseAdd (element);
		}
Example #20
0
		public void CopyTo (TypeElement[] array, int index)
		{
			((ICollection)this).CopyTo (array, index);
		}
Example #21
0
		public void Remove (TypeElement element)
		{
			BaseRemove (element.Type);
		}