Can I tell C# nullable references that a method is effectively a null check on a field : <p>Consider the following code:</p>

<pre><code>#nullable enable
class Foo
{
    public string? Name { get; set; }
    public bool HasName =&gt; Name != null;
    public void NameToUpperCase()
    {
        if (HasName)
        {
            Name = Name.ToUpper();
        }
    }
}
</code></pre>

<p>On the Name=Name.ToUpper() I get a warning that Name is a possible null reference, which is clearly incorrect.  I can cure this warning by inlining HasName so the condition is if (Name != null).</p>

<p>Is there any way I can instruct the compiler that a true response from HasName implies a non-nullability constraint on Name?  </p>

<p>This is important because HasName might actually test a lot more things, and I might want to use it in several places, or it might be a public part of the API surface.  There are many reasons to want to factor the null check into it's own method, but doing so seems to break the nullable reference checker.</p>
