2 ms·
According to the grammar int the OP, you need ()'s, no? new Thread(() => { doStuff(); }).Start(); Or can they be elided in C# or Scala?
by onedognight 15y ago
According to the grammar int the OP, you need ()'s, no?
new Thread(() => { doStuff(); }).Start();
Or can they be elided in C# or Scala?
- gnuvince 15y agoThe empty () are required in Scala. Don't know about C#.
- latch 15y agoyes, they are in C# as well.
- swax 15y agoActually for just that example you don't need any of it. new Thread(doStuff).Start();
- MatthewPhillips 15y agonah, it would have to be new Thread(new ThreadStart(doStuff)).Start();
- jeffz 15y agoSorry, but since C# 2.0 we could just write "new Thread(DoStruff)" or "SomeDelegate del = SomeMethod".
- politician 15y agoI 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");