Thread: [Adapdev-commits] Adapdev/src/Adapdev.Cache AbstractCache.cs,NONE,1.1 CacheItem.cs,NONE,1.1 CacheIte
Status: Beta
Brought to you by:
intesar66
From: Sean M. <int...@us...> - 2005-05-25 05:18:27
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Cache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10621/src/Adapdev.Cache Modified Files: Adapdev.Cache.csproj CacheManager.cs CacheUtil.cs FileCache.cs ICache.cs Added Files: AbstractCache.cs CacheItem.cs CacheItemCollection.cs CacheItemDictionary.cs CacheItemEnumerator.cs ICacheItem.cs ImmutableInMemoryCache.cs MutableInMemoryCache.cs SerializedCacheItem.cs TypeKey.cs Log Message: MIgrated reusable Perseus components Added SmartTreeView Added new caching framework Several Sql fixes Added business rule validation classes Added FieldAccessor for IL generation --- NEW FILE: TypeKey.cs --- using System; namespace Adapdev.Cache { /// <summary> /// Summary description for TypeKey. /// </summary> internal class TypeKey { public static string Build(Type t, string key) { return t.FullName + Separator + key; } public static string GetTypeName(string typekey) { return typekey.Substring(0, typekey.IndexOf(Separator)); } public static Type GetType(string typekey) { return Type.GetType(GetTypeName(typekey)); } public static string GetKey(string typekey) { return typekey.Substring(typekey.IndexOf(Separator), typekey.Length); } public static string Separator { get{return "---";} } } } --- NEW FILE: AbstractCache.cs --- using System; namespace Adapdev.Cache { /// <summary> /// Summary description for AbstractCache. /// </summary> public abstract class AbstractCache : ICache { #region ICache Members public void Add(int key, object o) { this.Add(key.ToString(), o); } public void Remove(Type t, int key) { this.Remove(t, key.ToString()); } public object Get(Type t, int key) { return this.Get(t, key.ToString()); } public CacheItem GetCacheItem(Type t, int key) { return this.GetCacheItem(t, key.ToString()); } public bool Contains(Type t, int key) { return this.Contains(t, key.ToString()); } public void Scavenge(Adapdev.Cache.Scavengers.IScavenger scavenger) { scavenger.Scavenge(this); } public void Copy(ICache cache) { CacheUtil.Copy(cache, this); } public abstract void Add(string key, object o); public abstract void Clear(); public abstract bool Contains(Type t, string key); public abstract int Count{get;} public abstract CacheItem[] Entries{get;} public abstract object Get(Type t, string key); public abstract CacheItem GetCacheItem(Type t, string key); public abstract void Populate(); public abstract void Remove(Type t, string key); #endregion } } --- NEW FILE: CacheItem.cs --- using System; using Adapdev; namespace Adapdev.Cache { /// <summary> /// Summary description for CacheItem. /// </summary> /// [Serializable] public class CacheItem : ICacheItem { protected object _object = null; protected string _key = String.Empty; protected int _ordinal = 0; protected DateTime _created; protected Type _objectType = null; public CacheItem(string key, object o) { this._key = key; this._object = o; this._created = DateTime.Now; this._objectType = o.GetType(); } public DateTime Created { get{return this._created;} } public Type ObjectType { get{return this._objectType;} } public virtual object Object { get{return this._object;} } public string Key { get{return this._key;} } public string TypeKey { get{return Adapdev.Cache.TypeKey.Build(this.ObjectType, this.Key);} } public int Ordinal { get{return this._ordinal;} set{this._ordinal = value;} } public override string ToString() { return Adapdev.Text.StringUtil.ToString(this); } } } Index: CacheManager.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Cache/CacheManager.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** CacheManager.cs 28 Feb 2005 01:31:43 -0000 1.1.1.1 --- CacheManager.cs 25 May 2005 05:17:46 -0000 1.2 *************** *** 1,2 **** --- 1,4 ---- + using System; + namespace Adapdev.Cache { *************** *** 6,33 **** public class CacheManager { ! private static CacheManager instance = null; ! private static ICache cache = new SerializedInMemoryCache(); ! private static readonly object padlock = new object(); ! public static CacheManager GetInstance() { - lock (padlock) - { - if (instance == null) - instance = new CacheManager(); - return instance; - } } ! public ICache GetCache() { ! return cache; ! } ! public static void SetCache(CacheType type) ! { ! cache = CacheUtil.GetNewCache(type); } - } ! } \ No newline at end of file --- 8,33 ---- public class CacheManager { ! private static ICache _cache = new ImmutableInMemoryCache(); ! private CacheManager() { } ! public static ICache Cache { ! get ! { ! return _cache; ! } ! set ! { ! if(_cache != null) ! { ! _cache.Clear(); ! } ! _cache = value; ! } } } ! } Index: FileCache.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Cache/FileCache.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** FileCache.cs 28 Feb 2005 01:31:43 -0000 1.1.1.1 --- FileCache.cs 25 May 2005 05:17:46 -0000 1.2 *************** *** 1,119 **** namespace Adapdev.Cache { - using System; - using System.IO; - using Adapdev.Serialization; - /// <summary> /// Summary description for FileCache. /// </summary> ! public class FileCache : ICache { ! private static string path = "FileCache/"; public FileCache() { ! SetUp(); } ! #region ICache Members ! public void Add(string id, object item) { ! CacheMetaData cmd = new CacheMetaData(); ! cmd.LastAccessed = DateTime.Now; ! cmd.ObjectId = id; ! cmd.ObjectType = item.GetType().AssemblyQualifiedName; ! Serializer.SerializeToBinary(cmd, path + id + ".cachemd"); ! Serializer.SerializeToBinary(item, path + id + ".cache"); } ! public void Remove(string id) { ! string f = path + id; ! if (File.Exists(f + ".cachemd")) ! { ! File.Delete(f + ".cachemd"); ! } ! if (File.Exists(f + ".cache")) ! { ! File.Delete(f + ".cache"); ! } } ! public object Get(string id) { ! CacheMetaData cmd = this.GetMetaData(id); ! if (cmd != null) ! { ! cmd.LastAccessed = DateTime.Now; ! return Serializer.DeserializeFromBinary(Type.GetType(cmd.ObjectType), path + id + ".cache"); ! } ! else ! { ! return null; ! } } ! public CacheMetaData GetMetaData(string id) { ! if (File.Exists(path + id + ".cachemd")) ! { ! return (CacheMetaData) Serializer.DeserializeFromBinary(typeof (CacheMetaData), path + id + ".cachemd"); ! } ! return null; } ! CacheMetaDataDictionary ICache.GetMetaData() { ! CacheMetaDataDictionary htmd = new CacheMetaDataDictionary(); ! foreach (string s in Directory.GetFileSystemEntries(path, ".cachemd")) { ! FileInfo f = new FileInfo(s); ! CacheMetaData cmd = this.GetMetaData(f.Name); ! htmd[f.Name] = cmd; } - - return htmd; } ! public void Clear() { ! Directory.Delete(path, true); ! SetUp(); } ! public int Count { ! get { return Directory.GetFiles(path).Length/2; } } ! public void SetScavenger(IScavenger scavenger) { ! // TODO: Add FileCache.SetScavenger implementation } ! public bool Contains(string id) { ! return File.Exists(path + id + ".cachemd"); } ! #endregion ! ! public static string Path { ! get { return path; } ! set { ! path = value; ! SetUp(); } } ! private static void SetUp() { ! Directory.CreateDirectory(path); } } ! } \ No newline at end of file --- 1,131 ---- + using System; + using System.Collections; + using System.IO; + using Adapdev.Serialization; + namespace Adapdev.Cache { /// <summary> /// Summary description for FileCache. /// </summary> ! public class FileCache : AbstractCache { ! private string _folderPath = String.Empty; ! private CacheItemDictionary _items = new CacheItemDictionary(); ! private static int _ordinal = 0; public FileCache() { ! this._folderPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "filecache"); ! if(!Directory.Exists(this._folderPath)) Directory.CreateDirectory(this._folderPath); ! ! FileCache._ordinal = this.Count; } ! public FileCache(string folderName) ! { ! this._folderPath = folderName; ! this._folderPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "filecache"); ! if(!Directory.Exists(this._folderPath)) Directory.CreateDirectory(this._folderPath); ! FileCache._ordinal = this.Count; ! } ! ! private string GetFileName(Type t, string key) { ! return TypeKey.Build(t, key) + ".cache"; ! } ! private string GetFullFileName(Type t, string key) ! { ! return Path.Combine(this._folderPath, this.GetFileName(t, key)); } ! private string GetFileNameWithoutExtension(string fileName) { ! return fileName.Substring(0, fileName.LastIndexOf(".")); } ! #region ICache Members ! ! public override void Add(string key, object o) { ! SerializedCacheItem c = new SerializedCacheItem(key, o); ! c.Ordinal = ++FileCache._ordinal; ! this._items[TypeKey.Build(o.GetType(), key)] = c; ! Serializer.SerializeToBinary(o, Path.Combine(this._folderPath, this.GetFileName(o.GetType(), key))); } ! public override void Remove(Type t, string key) { ! ! File.Delete(Path.Combine(this._folderPath, this.GetFileName(t, key))); ! this._items.Remove(TypeKey.Build(t, key)); } ! public override object Get(Type t, string key) { ! string typekey = TypeKey.Build(t, key); ! if(this._items.Contains(typekey)) { ! return (this._items[typekey] as SerializedCacheItem).Object; ! } ! else if(this.Contains(t, key)) ! { ! return Serializer.DeserializeFromBinary(t, this.GetFileName(t, key)); ! } ! else ! { ! return null; } } ! public override CacheItem GetCacheItem(Type t, string key) { ! return this._items[TypeKey.Build(t, key)] as SerializedCacheItem; } ! public override void Clear() { ! Directory.Delete(this._folderPath, true); ! Directory.CreateDirectory(this._folderPath); ! this._items.Clear(); } ! public override int Count { ! get ! { ! return Directory.GetFiles(this._folderPath).Length; ! } } ! public override bool Contains(Type t, string key) { ! return File.Exists(this.GetFullFileName(t, key)); } ! public override CacheItem[] Entries { ! get { ! CacheItem[] items = new CacheItem[this._items.Count]; ! this._items.Values.CopyTo(items, 0); ! return items; } } ! public override void Populate() { ! foreach(FileInfo f in new DirectoryInfo(this._folderPath).GetFiles()) ! { ! string fileName = this.GetFileNameWithoutExtension(f.Name); ! SerializedCacheItem c = new SerializedCacheItem(TypeKey.GetKey(fileName), Serializer.DeserializeFromBinary(TypeKey.GetType(fileName), f.FullName)); ! c.Ordinal = FileCache._ordinal++; ! this._items[f.Name] = c; ! } } + + #endregion } ! } --- NEW FILE: MutableInMemoryCache.cs --- using System; using System.Collections; using Adapdev.Serialization; namespace Adapdev.Cache { /// <summary> /// Summary description for ReadOnlyInMemoryCache. /// </summary> public class MutableInMemoryCache : AbstractCache { private CacheItemDictionary _hashtable = new CacheItemDictionary(); private int _ordinal = 0; public MutableInMemoryCache() { } #region ICache Members public override void Add(string key, object o) { CacheItem c = new CacheItem(key, o); c.Ordinal = ++this._ordinal; this._hashtable[TypeKey.Build(o.GetType(), key)] = c; } public override void Remove(Type t, string key) { this._hashtable.Remove(TypeKey.Build(t, key)); } public override object Get(Type t, string key) { return (this._hashtable[TypeKey.Build(t, key)] as CacheItem).Object; } public override CacheItem GetCacheItem(Type t, string key) { return this._hashtable[TypeKey.Build(t, key)] as CacheItem; } public override void Clear() { this._hashtable.Clear(); } public override bool Contains(Type t, string key) { return this._hashtable.Contains(TypeKey.Build(t, key)); } public override int Count { get { return this._hashtable.Count; } } public override CacheItem[] Entries { get { CacheItem[] items = new CacheItem[this._hashtable.Count]; this._hashtable.Values.CopyTo(items, 0); return items; } } public override void Populate() { } #endregion } } Index: Adapdev.Cache.csproj =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Cache/Adapdev.Cache.csproj,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Adapdev.Cache.csproj 14 Apr 2005 03:32:03 -0000 1.3 --- Adapdev.Cache.csproj 25 May 2005 05:17:46 -0000 1.4 *************** *** 90,93 **** --- 90,98 ---- HintPath = "..\..\lib\log4net.dll" /> + <Reference + Name = "Adapdev.Mock" + Project = "{7F1E28A3-0AC7-409A-BEC4-A8F39AB23022}" + Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" + /> </References> </Build> *************** *** 95,98 **** --- 100,108 ---- <Include> <File + RelPath = "AbstractCache.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "AdapdevAssemblyInfo.cs" Link = "..\AdapdevAssemblyInfo.cs" *************** *** 101,120 **** /> <File ! RelPath = "CacheManager.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "CacheMetaData.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "CacheMetaDataDictionary.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "CacheType.cs" SubType = "Code" BuildAction = "Compile" --- 111,135 ---- /> <File ! RelPath = "CacheItem.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "CacheItemCollection.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "CacheItemDictionary.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "CacheItemEnumerator.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "CacheManager.cs" SubType = "Code" BuildAction = "Compile" *************** *** 136,165 **** /> <File ! RelPath = "ICacheStats.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "InMemoryCache.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "SerializedInMemoryCache.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "SqlServerCache.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "Scavengers\FixedExpirationScavenger.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "Scavengers\InactiveExpirationScavenger.cs" SubType = "Code" BuildAction = "Compile" --- 151,185 ---- /> <File ! RelPath = "ICacheItem.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "ImmutableInMemoryCache.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "MutableInMemoryCache.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "SerializedCacheItem.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "TypeKey.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "Scavengers\AbsoluteExpirationScavenger.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "Scavengers\GreaterThanOrdinalScavenger.cs" SubType = "Code" BuildAction = "Compile" *************** *** 171,175 **** /> <File ! RelPath = "Scavengers\LRUScavenger.cs" SubType = "Code" BuildAction = "Compile" --- 191,200 ---- /> <File ! RelPath = "Scavengers\LIFONumberScavenger.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "Scavengers\SlidingExpirationScavenger.cs" SubType = "Code" BuildAction = "Compile" --- NEW FILE: SerializedCacheItem.cs --- using System; using Adapdev.Serialization; namespace Adapdev.Cache { /// <summary> /// Summary description for SerializedCacheItem. /// </summary> public class SerializedCacheItem : CacheItem { public SerializedCacheItem(string key, object o) : base(key, o) { this._key = key; this._object = Serializer.SerializeToBinary(o); this._created = DateTime.Now; this._objectType = o.GetType(); } public override object Object { get { return Serializer.DeserializeFromBinary(this._objectType, this._object as byte[]); } } public byte[] BinaryObject { get{return this._object as byte[];} } } } --- NEW FILE: CacheItemCollection.cs --- /****************************************** * Auto-generated by Codus * 4/20/2005 11:18:21 AM ******************************************/ using System; using System.Collections; namespace Adapdev.Cache { [Serializable()] public class CacheItemCollection : CollectionBase { public CacheItemCollection() { } public CacheItemCollection(IList value) { this.AddRange(value); } public CacheItemCollection(CacheItem[] value) { this.AddRange(value); } public CacheItem this[int index] { get { return ((CacheItem)(List[index])); } set { List[index] = value; } } public int Add(CacheItem value) { return List.Add(value); } public void AddRange(CacheItem[] value) { for (int i = 0; (i < value.Length); i = (i + 1)) { this.Add(value[i]); } } public void AddRange(IList value) { for (int i = 0; (i < value.Count); i = (i + 1)) { this.Add((CacheItem)value[i]); } } public bool Contains(CacheItem value) { return List.Contains(value); } public void CopyTo(CacheItem[] array, int index) { List.CopyTo(array, index); } public int IndexOf(CacheItem value) { return List.IndexOf(value); } public void Insert(int index, CacheItem value) { List.Insert(index, value); } public new CacheItemEnumerator GetEnumerator() { return new CacheItemEnumerator(this); } public void Remove(CacheItem value) { List.Remove(value); } } } Index: CacheUtil.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Cache/CacheUtil.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** CacheUtil.cs 28 Feb 2005 01:31:43 -0000 1.1.1.1 --- CacheUtil.cs 25 May 2005 05:17:46 -0000 1.2 *************** *** 1,6 **** namespace Adapdev.Cache { - using System; - /// <summary> /// Summary description for CacheUtil. --- 1,6 ---- + using System; + namespace Adapdev.Cache { /// <summary> /// Summary description for CacheUtil. *************** *** 8,27 **** public class CacheUtil { ! public static ICache GetNewCache(CacheType type) { ! switch (type) { ! case CacheType.IN_MEMORY: ! return new InMemoryCache(); ! case CacheType.SERIALIZED_IN_MEMORY: ! return new SerializedInMemoryCache(); ! case CacheType.SQLSERVER: ! return new SqlServerCache(); ! case CacheType.FILE: ! return new FileCache(); ! default: ! throw new NotImplementedException("CacheType " + type + " is not supported."); } } } ! } \ No newline at end of file --- 8,20 ---- public class CacheUtil { ! private CacheUtil(){} ! ! public static void Copy(ICache source, ICache target) { ! foreach(CacheItem item in source.Entries) { ! target.Add(item.Key, item.Object); } } } ! } --- NEW FILE: CacheItemEnumerator.cs --- /****************************************** * Auto-generated by Codus * 4/20/2005 11:18:21 AM ******************************************/ using System; using System.Collections; namespace Adapdev.Cache { public class CacheItemEnumerator : IEnumerator { private IEnumerator baseEnumerator; private IEnumerable temp; public CacheItemEnumerator(CacheItemCollection mappings) { this.temp = ((IEnumerable)(mappings)); this.baseEnumerator = temp.GetEnumerator(); } public CacheItemEnumerator(CacheItemDictionary mappings) { this.temp = ((IEnumerable)(mappings)); this.baseEnumerator = temp.GetEnumerator(); } public CacheItem Current { get { return ((CacheItem)(baseEnumerator.Current)); } } object IEnumerator.Current { get { return baseEnumerator.Current; } } public bool MoveNext() { return baseEnumerator.MoveNext(); } bool IEnumerator.MoveNext() { return baseEnumerator.MoveNext(); } public void Reset() { baseEnumerator.Reset(); } void IEnumerator.Reset() { baseEnumerator.Reset(); } } } Index: ICache.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Cache/ICache.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ICache.cs 28 Feb 2005 01:31:43 -0000 1.1.1.1 --- ICache.cs 25 May 2005 05:17:46 -0000 1.2 *************** *** 1,2 **** --- 1,6 ---- + using System; + using System.Collections; + using Adapdev.Cache.Scavengers; + namespace Adapdev.Cache { *************** *** 6,18 **** public interface ICache { ! void Add(string id, object item); ! void Remove(string id); ! object Get(string id); ! CacheMetaData GetMetaData(string id); ! CacheMetaDataDictionary GetMetaData(); void Clear(); ! int Count { get; } ! void SetScavenger(IScavenger scavenger); ! bool Contains(string id); } ! } \ No newline at end of file --- 10,29 ---- public interface ICache { ! void Add(string key, object o); ! void Add(int key, object o); ! void Remove(Type t, int key); ! void Remove(Type t, string key); ! object Get(Type t, int key); ! object Get(Type t, string key); ! CacheItem GetCacheItem(Type t, string key); ! CacheItem GetCacheItem(Type t, int key); void Clear(); ! int Count{get;} ! bool Contains(Type t, string key); ! bool Contains(Type t, int key); ! void Scavenge(IScavenger scavenger); ! CacheItem[] Entries{get;} ! void Populate(); ! void Copy(ICache cache); } ! } --- NEW FILE: ImmutableInMemoryCache.cs --- using System; using System.Collections; using Adapdev.Serialization; namespace Adapdev.Cache { /// <summary> /// Summary description for ReadOnlyInMemoryCache. /// </summary> public class ImmutableInMemoryCache : AbstractCache { private CacheItemDictionary _hashtable = new CacheItemDictionary(); private int _ordinal = 0; public ImmutableInMemoryCache() { } #region ICache Members public override void Add(string key, object o) { SerializedCacheItem c = new SerializedCacheItem(key, o); c.Ordinal = ++this._ordinal; this._hashtable[TypeKey.Build(o.GetType(), key)] = c; } public override void Remove(Type t, string key) { this._hashtable.Remove(TypeKey.Build(t, key)); } public override object Get(Type t, string key) { return (this._hashtable[TypeKey.Build(t, key)] as CacheItem).Object; } public override CacheItem GetCacheItem(Type t, string key) { return this._hashtable[TypeKey.Build(t, key)] as CacheItem; } public override void Clear() { this._hashtable.Clear(); } public override bool Contains(Type t, string key) { return this._hashtable.Contains(TypeKey.Build(t, key)); } public override int Count { get { return this._hashtable.Count; } } public override CacheItem[] Entries { get { CacheItem[] items = new CacheItem[this._hashtable.Count]; this._hashtable.Values.CopyTo(items, 0); return items; } } public override void Populate() { } #endregion } } --- NEW FILE: ICacheItem.cs --- using System; namespace Adapdev.Cache { /// <summary> /// Summary description for ICacheItem. /// </summary> public interface ICacheItem { DateTime Created{get;} Type ObjectType{get;} object Object{get;} string Key{get;} int Ordinal{get;set;} } } --- NEW FILE: CacheItemDictionary.cs --- using System; using System.Collections; namespace Adapdev.Cache { public class CacheItemDictionary : DictionaryBase { public CacheItem this[ object key ] { get { return( (CacheItem) Dictionary[key] ); } set { Dictionary[key] = value; } } public ICollection Keys { get { return( Dictionary.Keys ); } } public ICollection Values { get { return( Dictionary.Values ); } } public void Add( String key, String value ) { Dictionary.Add( key, value ); } public bool Contains( String key ) { return( Dictionary.Contains( key ) ); } public void Remove( String key ) { Dictionary.Remove( key ); } } } |