Operator category |
Operator |
Basic |
X. y F (x) A [x] X ++ X -- New Typeof Checked Unchecked -> |
RMB 1 |
+ - ! ~ ++ X -- X (T) x True False & Sizeof |
Multiplication |
* / % |
Addition |
+ - |
Transform |
< > |
Link and type detection |
< > <= > = Is As |
Equal |
= ! = |
Logic "and" |
& |
Logic XOR |
^ |
Logic "or" |
| |
Condition and |
&& |
Condition or |
| |
Conditional operation |
? : |
Assignment |
= + = -= * = /= % = & = | = ^ = <= >>= ?? |
C # Process Control-boolean operator-C #
Branch-execute code loops conditionally-execute the same statement repeatedly (repeated) boolean logic: Boolean comparison requires the use of Boolean comparison operators (also known as Relational operators) Boolean logical operators are as follows: boolean logical operator: =; Class: Binary; example expression: var1 = var2 = var3; Result: If var2 is equal to var3, the value of var1 is true; otherwise, the value is false; boolean logical operator :! =; Category: Binary; example expression: var1 = var2! = Var3; Result: If var2 is not equal to var3, the value of var1 is true; otherwise, it is false. boolean logical operator: <; Class: Binary; example expression: var1 = var2 <var3; result: If var2 is smaller than var3, the value of var1 is true; otherwise, it is false; Boolean logical operator >;class: Binary; example expression: var1 = var2> var3; Result: if var2 is greater than var3, the value of var1 is true, otherwise false. boolean logical operator: <=; Class: Binary; example expression: var1 = var2 <= var3; Result: if var2 is less than or equal to var3, the value of var1 is true, otherwise false; Boolean logical operator >=; class: Binary; example expression: var1 = var2> = var3; Result: if var2 is greater than or equal to var3, the value of var1 is true; otherwise, the value is false. boolean logical operator :!; Category: mona1; example expression: var1 =! Var2; Result: If var2 is false, the value of var1 is true, otherwise false (non-logical); Boolean logical operator: &; Category: Binary; example expression: var1 = var2 & var3; Result: if both var2 and var3 are true, the value of var1 is true; otherwise, the value is false (logical and); Boolean logical operator: |; Class: Binary; example expression: var1 = var2 | var3; Result: If var2 or var3 is true (or both), the value of var1 is true, otherwise false (logical or ); boolean logical operator: ^; Class: Binary; example expression: var1 = var2 ^ var3; Result: if one of var2 and var3 is true, the value of var1 is true, otherwise, the value is false (logical exclusive or). boolean operators & | are the same as boolean operators & | but the performance is better. boolean logical operator: &; Class: Binary; example expression: var1 = VaR 2 & var3; Result: if both var2 and var3 are true, the value of var1 is true; otherwise, the value is false (logical and); Boolean logical operator: ||; class: Binary; example expression: var1 = var2 | var3; Result: If var2 or var3 is rtue (or both), the value of var1 is true, otherwise false (logical or ); boolean value assignment operator: & =; Class: Binary; example expression: var1 & = var2; Result: The var1 value is the result of var2 & var3; Boolean value assignment operator: | =; class: Binary; example expression: var1 | = var2; Result: The var1 value is the result of var2 | var3; Boolean value assignment operator: ^ =; Category: Binary; example expression: var1 ^ = var2; Result: The var1 value is the result of var2 ^ var3. The result is the same as the &, | and ^ results, but the performance is better compared with the displacement OPERATOR:> =; Category: mona1; example Expression: var1 >>== var2; move the binary value of var1 to the right to obtain the value of var1. Displacement OPERATOR: <<==; Category: Mona; example expression: var1> = var2; move the binary value of var1 to the left to obtain the value of var1. The operator priority is ++, -- (used as the prefix); (), +, -(one dollar ),!, ~ *,/, % +,-<, >><, >,< =, >== ,! = &, |, ^, &, |, =, * =,/=, % =, + =,-+, <=, >>=, & =, ^ =, | = ++, -- (Used as a suffix)