What does it indicate ? in the following c # code?
?
var handler = CallBack; handler?.Invoke();
I read what before type can I use ? to indicate that it is a type with a null value. Does it do the same?
This is C # 6 code using a null conditional operator indicating that this code will not throw a NullReferenceException if the handler is null:
null conditional operator
NullReferenceException
handler
Delegate handler = null; handler?.Invoke();
which do not allow you to record null checks that you would need to do in previous versions of C #:
Delegate handler = null; if (handler != null) { handler.Invoke(); }