コード例 #1
0
        /// <summary>
        /// 初始化环境,3.5 使用
        /// </summary>
        /// <param name="types">需要初始化调用的静态类</param>
        public void Init(IEnumerable <Type> types)
        {
            if (_haveInit)
            {
                return;
            }

            container = new FrameworkContainer();
            _modules  = new FrameworkModules(this);
            cyclePool = new RecyclableObjectPool();
            if (types != null)
            {
                types.ForEach((type) =>
                {
                    TypeAttributes ta = type.Attributes;
                    if (ta.HasFlag(TypeAttributes.Abstract) && ta.HasFlag(TypeAttributes.Sealed))
                    {
                        RuntimeHelpers.RunClassConstructor(type.TypeHandle);
                    }
                });
            }

            if (onInit != null)
            {
                onInit();
            }
            deltaTime = TimeSpan.Zero;
            _disposed = false;
            _haveInit = true;
            sw_delta  = new Stopwatch();
            sw_init   = new Stopwatch();
            sw_init.Start();
        }
コード例 #2
0
 /// <summary>
 /// ctor
 /// </summary>
 public RecyclableObjectCollection()
 {
     _createPool = new RecyclableObjectPool();
     _memory     = new RecyclableObjectMemory();
 }