Hacker News new | ask | show | jobs
by jeffz 5401 days ago
Sorry, but since C# 2.0 we could just write "new Thread(DoStruff)" or "SomeDelegate del = SomeMethod".
1 comments

I can't resist, so,

    public static class ActionExtensions
    {
        public static void InvokeAsync(this Action<object> target, object context)
        {
            new Thread(obj => target(obj)).Start(context);
        }
    }

     ((Action<object>) (Console.WriteLine)).InvokeAsync("Hello, World");