Pretty simple question, but I couldn't find an answer with some googling.
Suppose I have a class
public class Test {
bool testBool { get; set; }
}
and a possible null instance
Test? maybeTest = // something that may or may not be null
How can I safely call a setter on that instance? maybeTest.testBool = true
throws a NPE if maybeTest
is null, and maybeTest?.testBool = true
doesn't compile.