© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
69 replies
RobinTTY

❔ Nullable bools

I just got into the situation where I needed to use nullable bools and I'm a little confused about how the compiler handles things. If I write my code like shown in picture 1 the compiler still thinks the variable
accessScopesSupported
accessScopesSupported
might be null inside the codeblock with an explicit check for null. If I use
.Value
.Value
inside the codeblock the compiler understands that the value cannot be null. My question is why? Shouldn't the null check be enough?
image.png
Screenshot_2023-05-24_190811.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

Pomello MySql not mapping Bools correctly?
C#CC# / help
4y ago
deserialize non-nullable
C#CC# / help
2y ago
✅ Generic nullable type
C#CC# / help
3y ago