Without using Action and Func, you can use MethodInvoker in case of void () delegation:
new MethodInvoker(Foo).BeginInvoke(null, null);
In addition, it should be noted that if you use the BeginInvoke method, you must call EndInvoke when the delegate has finished executing .. so this line above should either change to using the callback, or you need to save the delegate link .. Like this:
MethodInvoker mi = null; IAsyncResult ar = null; ar = (mi = new MethodInvoker(Foo)).BeginInvoke(null,null); .. sometime later after the delegate has completed executing mi.EndInvoke(ar);
This is true if you are using BeginInvoke. Therefore, I think in the end I would not recommend using the BeginInvoke method.
@Steven's solution using ThreadPool is a much better solution in my opinion .. and its clearly :)
source share