Created
June 7, 2017 08:36
-
-
Save supreettare/47c0f2cfc86a2b0c0092ae03afcde969 to your computer and use it in GitHub Desktop.
Is the comparison of time and null in the if statement below valid or not? Why or why not?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static DateTime time; | |
| /* ... */ | |
| if (time == null) | |
| { | |
| /* do something */ | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The code will compile.
Equality (==) operator always returns false when one operand is null and the other is a Value type.