using System; using System.Collections.Generic; namespace Framework { public partial class EventManager { private readonly List _tempExecuteList = new List(16); private Stack> _tempExecutePool = new Stack>(); private int _eventStack = 0; private List GetTempExecuteList() { if (_tempExecutePool.TryPop(out var list)) { return list; } return new List(8); } private void ReCycleTempExecuteList(List list) { if (_tempExecutePool.Count < MAX_EVENT_STACK) { list.Clear(); _tempExecutePool.Push(list); } } } }