线程化:c#是否具有Java Runnable接口的等价物? [英] Threading: does c# have an equivalent of the Java Runnable interface?
本文介绍了线程化:c#是否具有Java Runnable接口的等价物?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
c#是否具有Java Runnable接口的等价物?
Does c# have an equivalent of the Java Runnable interface?
如果不能实现,或者根本不需要它?
If not how could this be implemented or is it simply not needed?
谢谢。
推荐答案
不。 C#以不同于Java的方式处理线程。您只需创建一个新的System.Threading.Thread对象并将其传递给ThreadStart委托(这是您执行工作的函数)而不是继承Thread类,而不是继承它。
Nope. C# handles threads differently to Java. Rather than subclassing the Thread class, you simply create a new System.Threading.Thread object and pass it a ThreadStart delegate (this is the function where you do the work)..
这篇关于线程化:c#是否具有Java Runnable接口的等价物?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文