Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Actually for just that example you don't need any of it. new Thread(doStuff).Start();


nah, it would have to be new Thread(new ThreadStart(doStuff)).Start();


Sorry, but since C# 2.0 we could just write "new Thread(DoStruff)" or "SomeDelegate del = SomeMethod".


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");




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: