Will all methods in a logical expressions be executed?

前端 未结 5 2019
我在风中等你
我在风中等你 2021-01-27 17:35

In C#, given the two methods

 bool Action1(object Data);
bool Action2(object Data);

that are used in an if statement like this:

5条回答
  •  一个人的身影
    2021-01-27 18:16

    You can use a single | or & to get both methods to execute. It's one of the tricks that the Brainbench C# exam expects you to know. Probably of no use whatsoever in the real world but still, nice to know. Plus, it lets you confuse your colleagues in creative and devious ways.

提交回复
热议问题