The C# compiler is pretty smart. For example, let's say you have a function that returns either a string or null.
string? GetString()
{
...
}
var s = GetString()
Then if you try to naively use a string function, it will warn you. Eg. s.Contains(...)
will generate warning CS8602: Dereference of a …