C#C
C#7mo ago
enrico11011

✅ how do you properly handle a "Possible null reference return"?

i've got a property on my class that looks like so

private ViewModelBase? _CurrentPage;
...
public ViewModelBase CurrentPage
{
    get { return _CurrentPage; }
    set { this.RaiseAndSetIfChanged(ref _CurrentPage, value); }
}


vs is giving me a green squiggly in the get {} block saying the value might be null. The program itself compiles and runs but just out of curiosity how do you properly resolve the warning?
Was this page helpful?