Exemplo n.º 1
0
        public override object GetValue(string name, Type type, object defaultValue, IFormatProvider provider, OnNotFound onNotFound)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (name.Length == 0)
            {
                throw new ArgumentOutOfRangeException("'name' is zero-length.");
            }

//			// mbr - 07-03-2006 - do we need to flush?
//			CheckFlush();

            // get...
            ConfigItem item     = (ConfigItem)this.Items[name];
            object     useValue = null;

            if (item != null)
            {
                useValue = item.Data;
            }
            else
            {
                useValue = defaultValue;
            }

            // convert...?
            if (type != null)
            {
                return(ConversionHelper.ChangeType(useValue, type, Cultures.System));
            }
            else
            {
                return(useValue);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Adds a <see cref="ConfigItem"/> instance to the collection.
 /// </summary>
 public int Add(ConfigItem item)
 {
     return(base.Add(item));
 }