空铸造作为对象? [英] Casting null as an object?
本文介绍了空铸造作为对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我碰到这个代码今天
AsyncInvoke(OnTimeMessageTimer, (object)null, (ElapsedEventArgs)null);
这有什么不对的地方还是没有?
Is there anything wrong with it or no?
推荐答案
有时候,你需要这个当方法重载......告诉你调用哪一个编译器。一个空对象仍然是空,它是安全的。
Sometimes, you need to to this when the method is overloaded... to tell the compiler which one you are calling. A null object is still null and it is safe.
这篇关于空铸造作为对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文