c# - "is" operator compile-time warning -
from reference:
the keyword causes compile-time warning if expression known true.
i tried create example:
class myclass { public void method(myclass c) { if (c myclass) { //... } if (c object) { //... } } } but don't warnings. why?
can show me example warning (because expression true)?
it works false.
the is operator return false if value null, if call method(null) not enter either if-block.
however, if myclass struct (i.e. not nullable), produce warning.
Comments
Post a Comment