C尖锐的多线程 [英] C sharp multithreading

查看:81
本文介绍了C尖锐的多线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你能告诉我,在类构造函数本身启动Thread是不错的做法?

Could you tell me please,Is it the good practice to start the Thread within Class constructor itself??

推荐答案

参见http://msdn.microsoft.com/en-us/library/aa645740(v=vs.71)。 aspx [ ^ ]。


hi
Sarita S

如果从使用静态构造函数的Singleton类开始,那就更好如果启动一个线程它不应该损害性能,因为静态构造函数只在第一次调用instance属性时执行。



你也可以试试Singleton with Static Intitalization
hi Sarita S
it would be good if you start with "Singleton Class with Static Constructor" then even if start a thread it should not harm the performance because the static constructor is only executed when the instance property is called the first time.

you can also try out "Singleton with Static Intitalization"


这篇关于C尖锐的多线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆