One, C # operator Precedence
The C # operator is also known as C # operators.
When an expression contains more than one operator, the order of operations for the operator occurs. In C #, the precedence of operators is used to solve the order of operations. The precedence of an operator controls the order in which a single operator evaluates.
Each operator has its own priority, which determines its order of operations in an expression. In the same expression, a high-priority operator is executed before the lower-priority operator, and the same precedence is performed from left-to-right or right-to-left in the same order.
The following is a list of precedence for C # operators, which are sorted by their precedence from highest to lowest. Operators of the same classification have the same precedence.
Second, prompt
? When an operand appears between two operators with the same precedence, the operators are executed from left to right in the order in which they appear.
In addition to the assignment operators, all binary operators are executed in left-to-right order. For example: X+Y+Z is evaluated according to the (X+y) +z.
The assignment operator and the condition operator (?:) are executed in right-to-left order. For example: X=Y=Z is evaluated according to X= (Y=Z).
? If the effective order of the operators is not correctly determined, you can change the order of operations by using parentheses, that is, expressions in parentheses are evaluated first, and expressions outside the parentheses are computed. This effectively determines the order of operations of the operators.
C # Operator Precedence