可能重复:
Type Checking: typeof, GetType, or is?typeof和当比较对象类型时有什么区别?
所以我比较控件的类型,我想我可以做这样的事情。
if (control[0].GetType() is TSendForReview)
但是,我收到以下警告。
The given expression is never of the provided ('MyApp.Controls.TSendForReview') type
所以,如果我切换到这个警告消失。
if (control[0].GetType() == typeof(TSendForReview))
这个警告究竟意味着什么,并且比较控件类型时typeof和它之间有什么区别。
可能重复http://stackoverflow.com/questions/7765372/what-is-the-difference-between-typeof-and-the-is-keyword或[类型检查:typeof运算,的GetType,或是吗?](http://stackoverflow.com/questions/983030/type-checking-typeof-gettype-oris) – 2012-07-19 20:49:21