Created
October 25, 2016 14:52
-
-
Save controlflow/8a51ab838dd58dd60290d4bcb5e74c1f 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
var s = x as string; | |
if (s == null) { | |
s = DefaultValue(); | |
} | |
Console.WriteLine(s); | |
// ==> | |
if (!(x is string s)) { | |
s = DefaultValue(); | |
} | |
Console.WriteLine(s); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment