© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•15mo ago•
11 replies
Decoherence

Null check

if (maybe is int number)
{
  Console.WriteLine($"The nullable int 'maybe' has the value {number}");
}
if (maybe is int number)
{
  Console.WriteLine($"The nullable int 'maybe' has the value {number}");
}

VS
if(maybe != null)
{
  Console.WriteLine($"The nullable int 'maybe' has the value {maybe}");
}
if(maybe != null)
{
  Console.WriteLine($"The nullable int 'maybe' has the value {maybe}");
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

null check raising errors
C#CC# / help
2y ago
How to check options for null?
C#CC# / help
3y ago
✅ How to automatically check for null?
C#CC# / help
3y ago
NullReferenceException but checking for Null?
C#CC# / help
2y ago