public static CallBackObject GetPoolObject(Action <object> callBack, object result) { CallBackObject callBackObject = null; if (PoolObjects.Count != 0) { callBackObject = PoolObjects.Dequeue(); } else { callBackObject = new CallBackObject(); } callBackObject.CallBack = callBack; callBackObject.Result = result; return(callBackObject); }
public static void SetPoolObject(CallBackObject obj) { obj.CallBack = null; obj.Result = null; PoolObjects.Enqueue(obj); }