C# version of Java Runnable? (delegate?)

Alexander Bird picture Alexander Bird · Aug 16, 2011 · Viewed 8.6k times · Source

I could not find a direct answer to this question yet in SO. Is there a predefined delegate with void (void) signature?

Answer

David Yaw picture David Yaw · Aug 16, 2011

Action has the signature you're looking for. However, it doesn't mean the same thing as Runnable does: Runnable generally indicates that the run() method is intended to be run on a Thread, while Action makes no indication. For that you'd want ThreadStart, which has the same signature, and does make that indication.

If all you need is a delegate with no parameters, Action is what you want. If you're dealing with threads and need to indicate the start method, use ThreadStart.