using System;
using System.Collections;
namespace Netlm.DataGridGost
{
	/// <summary>
	/// KeyValuePairCollection µÄÕªÒªËµÃ÷¡£
	/// </summary>
	public class KeyValuePairCollection :CollectionBase
	{
		public KeyValuePairCollection()
		{

		} 

		public KeyValuePair this[int index]
		{
			get {return List[index] as KeyValuePair;}
			set {List[index] = value;}
		} 
		public int this[KeyValuePair item]
		{
			get {return List.IndexOf(item);}
		} 

		public int Add(KeyValuePair item)
		{
			return List.Add(item);
		} 

		public void AddRange(KeyValuePair[] items)
		{
			lock(List.SyncRoot)
			{
				for (int i = 0; i < items.Length; i++)
					List.Add(items[i]);
			} 
		} 

		public void Remove(KeyValuePair item)
		{
			List.Remove(item);
		} 

		public new void Clear()
		{
			List.Clear();
		} 

		public int IndexOf(KeyValuePair item)
		{
			return List.IndexOf(item);
		}
		public string GetValue(string key)
		{
			for(int i=0;i<List.Count ;i++)
			{
				KeyValuePair kv = List[i] as KeyValuePair;
				if(kv.Key.Trim().Equals(key.Trim()))
					return kv.Value;
			}
			return null;
		}
	}
}
