Search code examples
c#language-designkeyword

Why does the is keyword require a non-null expression?


The MSDN documentation for the is keyword says:

expression is not null

Why? If MethodThatReturnsNull() is type were called shouldn't that return false since null certainly isn't that type?


Solution

  • It does return false if expression is null. Perhaps you're misunderstanding the documentation?