What is the second meaning of a single ampersand in C#?

后端 未结 6 908
孤城傲影
孤城傲影 2021-02-14 03:52

I have used the single ampersand (&) in C# to mean \"check the second conditional statement even if the first is false\".

But the

6条回答
  •  一个人的身影
    2021-02-14 04:24

    Here:

    The unary & operator returns the address of its operand (requires unsafe context).

    Binary & operators are predefined for the integral types and bool. For integral types, & computes the logical bitwise AND of its operands. For bool operands, & computes the logical AND of its operands; that is, the result is true if and only if both its operands are true.

    The & operator evaluates both operators regardless of the first one's value.

提交回复
热议问题