© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
20 replies
Chocohoop

❔ Why does this code give the CS8604 warning?

I'm confused why the below code gives the CS8604 warning. As far as I am concerned, I am null checking so it shouldn't appear. How can I improve it?
string? myString = null;

var stringIsEmpty = myString == null;

if (!stringIsEmpty)
{
    var reversedString = myString.Reverse();
    Console.WriteLine(reversedString);
}
string? myString = null;

var stringIsEmpty = myString == null;

if (!stringIsEmpty)
{
    var reversedString = myString.Reverse();
    Console.WriteLine(reversedString);
}
image.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

Similar Threads

Why does it give the error?
C#CC# / help
2y ago
why does this code not work???
C#CC# / help
3w ago
❔ Why does this code always return False?
C#CC# / help
3y ago
Why does this code have a Required attribute?
C#CC# / help
4y ago