Dec 6, 2018

Action(arg) vs Action.Invoke(arg)

Action(arg) : Cannot use Null-Conditional operator
Action.Invoke(arg) : Can use Null-Conditional operator with C# 6

----------------
Action(arg) :

Action DoSomething = null;
if(DoSomething != null)
     DoSomething();


C#6 Action.Invoke(arg) :

Action DoSomething = null;
DoSomething?.Invoke();

No comments:

Post a Comment