Created
October 25, 2017 04:51
-
-
Save Ibro/b7a71592b1863b820b40d1ff7570bd78 to your computer and use it in GitHub Desktop.
C# 7 out variables - https://codingblast.com/c-7-new-features
This file contains 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
// Out variables | |
// Old way | |
int parsedOld; | |
string parseMeOld = "222224"; | |
int.TryParse(parseMeOld, out parsedOld); | |
Console.WriteLine(parsedOld); | |
// New way | |
string parseMe = "3115"; | |
int.TryParse(parseMe, out int parsed); | |
Console.WriteLine(parsed); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment