namespace X10D.WinForms { #region Using Directives using System.Windows.Forms; #endregion /// /// Extension methods for . /// public static class ControlExtensions { /// /// Thread-safe method invocation. Calls if /// returns . /// /// The control from which to invoke. /// The action to invoke. public static void InvokeIfRequired(this Control control, MethodInvoker action) { if (control?.InvokeRequired ?? false) { control.Invoke(action); } else { action(); } } } }