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 Stack _eventSendingStack = new Stack(MAX_EVENT_STACK + 1); 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); } } } }