public void Test() { bool y = true; MyTest z = new MyTest(); MyTest w = new MyTest(); var x = y ? z?.Invoke() : w?.Invoke(); }