Beispiel #1
0
        static public BetterLinkedListNode <T> Get()
        {
            BetterLinkedListNode <T> node = ObjPool <BetterLinkedListNode <T> > .Get();

            if (node != null)
            {
                node.List  = default(BetterLinkedList <T>);
                node.Value = default(T);
            }
            return(node);
        }
Beispiel #2
0
        public static T Get()
        {
            lock (instanceList)
            {
                if (instance == null)
                {
                    AddInstance(instance = new ObjPool <T>());
                }
            }
            lock (instance.pool)
            {
#if UNITY_EDITOR
                instance.detecter.IncreseInstance();
#endif
                return(instance.pool.Count > 0 ? instance.pool.Dequeue() : Activator.CreateInstance <T>());
            }
        }