Thursday, 04 June, 2026г.
russian english deutsch french spanish portuguese czech greek georgian chinese japanese korean indonesian turkish thai uzbek

пример: покупка автомобиля в Запорожье

 

c# tutorial | operators in c#

c# tutorial | operators in c#У вашего броузера проблема в совместимости с HTML5

C# provides a number of operators.
These operators can be classified into 5 major groups.
Arithmetic operators that perform arithmetic operations with numeric operands.
Comparison operators that compare numeric operands.
Boolean logical operators that perform logical operations with bool operands.
And Equality operators that check if their operands are equal or not.
There are two categories of arithmetic operators.
Under Unary operators, there is increment, decrement, plus, and minus operators.
And under Binary operators, we have multiplication, division, remainder, addition, and subtraction operators.
The unary increment operator increments its operand by 1.
The increment operator is supported in two forms. the postfix increment operator.
And the prefix increment operator.
The difference is that in the postfix, the increment happens after the variable assignment.
Similarly, we have postfix and prefix decrement operators which decrements the operand by 1.
The unary plus operator returns the value of its operand.
And the unary minus operator computes the numeric negation of its operand.
And here is a simple usage examples for binary arithmetic operators.
Multiplication, division, remainder, subtraction, and addition.
The comparison operators less than, greater than, less than or equal, and greater than or equal, also known as relational operators, compare their operands. And the result is a Boolean value.
The following operators perform logical operations with bool operands.
The not operator computes logical negation of its operand.
That is, it produces true, if the operand evaluates to false, and false, if the operand evaluates to true.
The ‘and’ operator computes the logical ‘and’ of its operands.
In the example, the result it true only if both the operands are true.
The ‘or’ operator computes the logical ‘or’ of its operands.
In the example, the result it true if at least one of the operand is true.
The exclusive ‘or’ operator computes the logical exclusive ‘or’, also known as the logical ‘xor’, of its operands.
The conditional logical ‘and’, and the conditional logical ‘or’ operators works similar way as that of the logical ‘and’, and the ‘or’ operators.
The major difference is that in conditional logical operators, if the result of the entire operation can be determined by the first argument, the second argument is not evaluated.
And the logical ‘and’, and logical ‘or’ operators are actually bitwise operators.
For example, in conditional ‘and’ between false and true, the result is determined to be false just because the first argument is false.
Lets now see the examples in Bitwise and shift operators.
The Bitwise complement operator produces a bitwise complement of its operand by reversing each bit.
The Left-shift operator shifts its left-hand operand left by the number of bits defined by its right-hand operand.
The left-shift operation discards the high-order bits that are outside the range of the result type and sets the low-order empty bit positions to zero, as the following example shows.
The Right-shift operator shifts its left-hand operand right by the number of bits defined by its right-hand operand.
The right-shift operation discards the low-order bits, as the following example shows.
The equality and inequality operators check if their operands are equal or not.
By default, two non-record reference-type operands are equal if they refer to the same object.
Two string operands are equal when both of them are null or both string instances are of the same length and have identical characters in each character position.
Two delegate operands of the same run-time type are equal when both of them are null or their invocation lists are of the same length and have equal entries in each position.

Мой аккаунт