www.pudn.com > WebPager.rar > NameObjectCollection.cs, change:2005-01-24,size:1491b


using System; 
using System.Collections.Specialized; 
 
namespace Hooyee.Utils { 
	#region Class NameObjectCollection 
	/// <summary> 
	/// 命名的对象集合。 
	/// </summary> 
	/// <remarks> 
	/// <see cref="NameObjectCollectionBase"/> 的一个具体实现。 
	/// </remarks> 
	[Serializable()] 
	public sealed class NameObjectCollection : NameObjectCollectionBase { 
		public NameObjectCollection() : base(){ 
		} 
 
		public void Add(string name,object value) { 
			base.BaseAdd(name,value); 
		} 
 
		public void Clear() { 
			base.BaseClear(); 
		} 
 
		public bool HasKeys() { 
			return base.BaseHasKeys(); 
		} 
 
		public bool Contains(string name) { 
			foreach(string key in Keys) { 
				if (key == name) 
					return true; 
			} 
			return false; 
		} 
 
		public void Remove(string name) { 
			base.BaseRemove(name); 
		} 
 
		public object Get(int index) { 
			return base.BaseGet(index); 
		} 
 
		public object Get(string name) { 
			return base.BaseGet(name); 
		} 
 
		public void Set(int index,object value) { 
			base.BaseSet(index,value); 
		} 
 
		public void Set(string name,object value) { 
			base.BaseSet(name,value); 
		} 
 
		public object this[int index] { 
			get{ 
				return base.BaseGet(index); 
			} 
			set{ 
				base.BaseSet(index,value); 
			} 
		} 
 
		public object this[string name] { 
			get{ 
				if (!Contains(name)) 
					base.BaseAdd(name,null); 
				return base.BaseGet(name); 
			} 
			set{ 
				base.BaseSet(name,value); 
			} 
		} 
	} 
	#endregion 
}