Do nothing when “other side” of ternary operator is reached?

后端 未结 5 1783
醉酒成梦
醉酒成梦 2021-01-12 01:43

Note: I\'ve seen this question asked sometimes before (a, b, c), but neither of these was in C#, nor helpful.

Assume I\'m using the ? : ternary

5条回答
  •  南笙
    南笙 (楼主)
    2021-01-12 02:40

    Why would you want to use a ternary when you obviously need two parameters? You can simply use an if statement:

     if(Condition())Action();
    

提交回复
热议问题