关于这个类,能不能举一个在数据增删查改或者绑定数据方面的例子来看看。
using System;
using System.Collections.Generic;namespace DomainBase
{
    public class ObjectCache
    {
        //Dictionary<K,T> 会自动维护一个空链表来保存不用的单元。
        //这里,使用被缓存对象的“弱引用”,允许这些对象被垃圾回收。        private Dictionary<string, WeakReference> Buffer = new Dictionary<string, WeakReference>();        public object this[string key]
        {
            get
            {
                WeakReference ret;
                if (Buffer.TryGetValue(key, out ret) && ret.IsAlive)
                    return ret.Target;
                else
                    return null;
            }
            set
            {
                WeakReference ret;
                if (Buffer.TryGetValue(key, out ret))
                    ret.Target = value;
                else
                    Buffer.Add(key, new WeakReference(value));
            }
        }        public void Remove(string key)
        {
            Buffer.Remove(key);
        }
    }
}