Get the App
SLTechnology News&Howtos  ›  Servers  › 

C # Learning-basic introduction (3) expressions and operators in C #

Shulou Source: shulou.com Published: 2022-06-02 02:07:54 10月02日 Update

Expressions and operators in C #

An expression consists of operands and operators

Operator: +-* /%

Self-increment and self-subtraction operator: bounded _ subtractive + (take the value first, then increase); bounded _ Musi _ a (first subtract, then take the value)

Assignment operator =: you need to pay attention to the implicit conversion of the value types on the left and right sides of the assignment.

Relational (comparison) operator: > = < =! =

Logical operator: no! And & & or | (if you use & or |, the efficiency is not & &, | High efficiency)

Bit operator: bitwise and operation 5-4-4. Because 5: 00101, 4: 00100, bitwise and get 00100

Bitwise or operational 3 | 6 / 7. Because 300011,600110, bitwise or get 00111 bitwise inverse operation ~ 7 instead of-8. Because 700000111, bitwise inversion results in 11111000 bitwise XOR 10 ^ 3 = 9. Because 100010103000011, you get 001001 by bit XOR.

Shift operation: the shift to the left is to the power of * 2. Moving a few places to the right is divided by two to the power.

Special operator:

Priority of the operator: the priority of the following figure is from top to bottom, from high to low. (combination means sibling from right to left, left to right)

Tags: Operations operators expressions precedence that is efficiency clocking special following figure siblings operands types logic problems fundamentals learning Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn OPPO Reno Docker Redmi Microsoft