I have a simple null check on a property getting but for some reason it won't compile.
This is how it looks
private TestObj _someObj;
public bool IsActive
{
get { return _someObj?.IsActive; }
}
I thought the ?
would return false if _someObj
was null ? Have i misunderstood its use here?
The error i get:
Cannot implicitly convert type `bool?' to `bool'
I tried adding an if statement around it but same problem occurred.
Hope you can help explain my misunderstanding.