Skip to content

Instantly share code, notes, and snippets.

@rorywoods
Created March 23, 2022 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rorywoods/d6486a6cbea6a85bffa49a2e1d1bc932 to your computer and use it in GitHub Desktop.
Save rorywoods/d6486a6cbea6a85bffa49a2e1d1bc932 to your computer and use it in GitHub Desktop.
int? maybe = 12;
if (maybe is int number)
{
Console.WriteLine($"The nullable int 'maybe' has the value {number}");
}
else
{
Console.WriteLine("The nullable int 'maybe' doesn't hold a value");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment