Created
December 4, 2014 15:04
-
-
Save OdeToCode/1e688037c6d1fb7483fb to your computer and use it in GitHub Desktop.
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
| // this: | |
| var foo = "hi!"; | |
| var length = foo?.Length; | |
| // will create this: | |
| string str = "hi!"; | |
| int? nullable = str != null ? new int?(str.Length) : new int?(); | |
| // while this: | |
| var foo = "hi!"; | |
| int length = foo?.Length; | |
| // becomes this: | |
| "Error CS0266 Cannot implicitly convert type 'int?' to 'int'. An explicit conversion exists (are you missing a cast?)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment