Question Mark syntax on method call [duplicate]

This is C#6 code using the null conditional operator indicating that this code will not throw a NullReferenceException exception if handler is null:

Delegate handler = null;
handler?.Invoke();

which avoid you writing null checks that you would have to do in previous versions of the C# language:

Delegate handler = null;
if (handler != null)
{
    handler.Invoke();
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)