为什么manualresetevent可以有一个实例但是有静态? [英] Why manualresetevent can have an instance but with static?

查看:67
本文介绍了为什么manualresetevent可以有一个实例但是有静态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

代码



The code

private static ManualResetEvent mre = new ManualResetEvent(false);





但是 MSDN





But by MSDN

It is not possible to create instances of a static class using the new keyword.





我尝试过:



不确定这个概念。一些例子有静态,另一些没有。困惑。



What I have tried:

Not sure the concept. Some examples have static, other not. Confused.

推荐答案

那是因为ManualResetEvent不是静态类。



在你的例子中,变量持有您创建的实例 mre ,是静态成员 [ ^ ]。
That's because ManualResetEvent is NOT a static class.

In your example, the variable holding the instance you created, mre, is a static member[^].


这篇关于为什么manualresetevent可以有一个实例但是有静态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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