Typesafe fire-and-forget asynchronous delegate invocation in C#
- by LBushkin
I recently found myself needing a typesafe "fire-and-forget" mechanism for running code asynchronously.
Ideally, what I would want to do is something like:
var myAction = (Action)(() => Console.WriteLine("yada yada"));
myAction.FireAndForget(); // async invocation
Unfortunately, the obvious choice of calling BeginInvoke() without a…