C#C
C#3y ago
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);
}
image.png
Was this page helpful?