コード例 #1
0
        public static ProtocolObject Get(int ClassID)
        {
            ProtocolObjectPool pool = poolList[ClassID];

            if (pool.unusedObjs.Count > 0)
            {
                int            index = pool.unusedObjs.Count - 1;
                ProtocolObject obj2  = pool.unusedObjs[index];
                pool.unusedObjs.RemoveAt(index);
                obj2.OnUse();
                return(obj2);
            }
            return((ProtocolObject)Activator.CreateInstance(pool.ClassType));
        }
コード例 #2
0
        public static ProtocolObject Get(int ClassID)
        {
            ProtocolObjectPool protocolObjectPool = ProtocolObjectPool.poolList.get_Item(ClassID);

            if (protocolObjectPool.unusedObjs.get_Count() > 0)
            {
                int            num            = protocolObjectPool.unusedObjs.get_Count() - 1;
                ProtocolObject protocolObject = protocolObjectPool.unusedObjs.get_Item(num);
                protocolObjectPool.unusedObjs.RemoveAt(num);
                protocolObject.OnUse();
                return(protocolObject);
            }
            return((ProtocolObject)Activator.CreateInstance(protocolObjectPool.ClassType));
        }