Using C# 2.0 and the MethodInvoker delegate, I have a GUI application receiving some event from either the GUI thread or from a worker thread.
I use the following pa
Personally I like this method:
private void ExecuteSecure(Action a) { if (InvokeRequired) BeginInvoke(a); else a(); }
And then you can write one-liners like this:
ExecuteSecure(() => this.Enabled = true);