public static void FormExecute(Delegate a) { if (a == null) { throw new ArgumentNullException(nameof(a)); } if (SyncObject.InvokeRequired) { SyncObject.InvokeCorrectly(a); } else { a.DynamicInvoke(); } }
public static void FormExecute <T>(Action <T> a, T b) { if (a == null) { throw new ArgumentNullException(nameof(a)); } if (SyncObject.InvokeRequired) { SyncObject.InvokeCorrectly(new MethodInvoker(() => { a.Invoke(b); })); } else { a.Invoke(b); } }