v7.3.2018.0614   重构高性能资源池,减少GC压力,增加线程池,让异步任务得到平等竞争CPU的机会
大石头 编写于 2018-06-14 17:56:44
X
using System.Reflection;
using NewLife.Collections;

namespace NewLife.Reflection
{
    /// <summary>事件扩展</summary>
    public class EventInfoX : MemberInfoX
    {
        #region 属性
        private EventInfo _Event;
        /// <summary>事件</summary>
        public EventInfo Event
        {
            get { return _Event; }
            set { _Event = value; }
        }
        #endregion

        #region 构造
        private EventInfoX(EventInfo ev) : base(ev) { Event = ev; }

        private static DictionaryCache<EventInfo, EventInfoX> cache = new DictionaryCache<EventInfo, EventInfoX>();
        /// <summary>创建</summary>
        /// <param name="ev"></param>
        /// <returns></returns>
        public static EventInfoX Create(EventInfo ev)
        {
            if (ev == null) return null;

            return cache.GetItem(ev, delegate(EventInfo key)
            {
                return new EventInfoX(key);
            });
        }
        #endregion
    }
}