private static void EventCallback(IntPtr eventId, int executionStatus, IntPtr userData) { int callbackId = userData.ToInt32(); CallbackData callbackData = GetCallback(callbackId); callbackData.UserMethod(callbackData.EventObject, (ExecutionStatus)executionStatus, callbackData.UserData); RemoveCallback(callbackId); }