Threading: does c# have an equivalent of the Java Runnable interface?

前端 未结 7 1106
礼貌的吻别
礼貌的吻别 2021-01-31 15:44

Does c# have an equivalent of the Java Runnable interface?

If not how could this be implemented or is it simply not needed?

thanks.

7条回答
  •  说谎
    说谎 (楼主)
    2021-01-31 16:06

    The closest to a high level task-oriented threading API would be a BackgroundWorker. As others have mentioned, .NET (and thus C#) use delegates for representing a callable method. Java doesn't have that concept (function pointers), and instead uses interfaces for callable objects.

提交回复
热议问题