从其他类访问诸如System.Timers.Timer之类的静态对象 [英] accessing static objects like System.Timers.Timer from other classes
本文介绍了从其他类访问诸如System.Timers.Timer之类的静态对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在类中使用静态对象,并且可以从其他类(包括msmq回调方法和联网回调方法(OnReceaive(...)等)中)访问它们.
I use static objects in my class and can access them from other classes, including from msmq callback methods and also networking callback methods(OnReceaive(...) etc).
问题是当我尝试访问诸如System.Timers.Timer之类的静态对象时
Problem is when I try to access static objects like System.Timers.Timer
在这种情况下,它以异常结束
In this case it ends up with exception
有人可以参考吗?
致谢
Izack
推荐答案
>问题是当我尝试访问诸如System.Timers.Timer
System.Timers.Timer 不是静态的财产.这是一个类
System.Timers.Timer is not a static property. it is a class
这篇关于从其他类访问诸如System.Timers.Timer之类的静态对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文