Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class Helpers
- {
- public static void InvokeAction<T, U>(this T control, Action<U> action, U args) where T : Control
- {
- if (control.InvokeRequired)
- {
- control.Invoke(action, args);
- }
- else
- {
- action(args);
- }
- }
- public static void InvokeAction(this Control control, Action action)
- {
- if (control.InvokeRequired)
- {
- control.Invoke(action);
- }
- else
- {
- action();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement