Created
October 25, 2017 04:51
Star
You must be signed in to star a gist
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