Created
September 25, 2014 08:07
-
-
Save ThomasArdal/ec04af58cf66aa9cdccc to your computer and use it in GitHub Desktop.
TryParse boolean with declaration expression
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
if (bool.TryParse("true", out var result)) | |
{ | |
Console.WriteLine("This is a bool with value. " + result); | |
} | |
else | |
{ | |
Console.WriteLine("Not a bool, yo! " + result); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment