首页 > Windows开发 > 详细

C# - is

时间:2015-06-23 15:08:46      阅读:236      评论:0      收藏:0      [点我收藏+]


Checks if an object is compatible with a given type.

An is expression evaluates to true if the provided expression is non-null, and the provided object can be cast to the provided type without causing an exception to be thrown.

The is keyword causes a compile-time warning if the expression is known to always be true or to always be false, but typically evaluates type compatibility at run time.

The is operator cannot be overloaded.

Note that the is operator only considers reference conversions, boxing conversions, and unboxing conversions. Other conversions, such as user-defined conversions, are not considered.

Anonymous methods are not allowed on the left side of the is operator. This exception includes lambda expressions.

C# - is

原文:http://www.cnblogs.com/bhlsheji/p/4595271.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!