Here, we will discuss the remaining operators in C#..
It compares two operands and returns true or false.
Logical operators perform a logical operation on bool operands.
example
a= 5;
b= 6;
a<b //this returns true , means if b is greater than a then it will return true(here it returns true )
!a<b //this returns false , means if b is not greater than a (here it returns true )
Bitwise operator performs bit by bit operation.
We have various bitwise operators
Example
Let’s say,
A = 62; and B = 10;
Then converting into the binary format they are as follows −
A= 0011 1110
B= 0000 1010
Performinng Binary AND Operator (&):
A & B= 0000 1010
Performinng Binary OR Operator (|):
(A ^ B) = 0011 1110
Performinng Binary XOR Operator (^):
(A ^ B) = 0011 0100
Binary Ones Complement Operator
(~A )= 1100 0001
Performinng Binary Left Shift Operator (<<):
A << 2 = 1111 0010
Performinng Binary AND Operator (&):
A >> 2 = 0000 1111
The assignment operator = assigns its right had value to its left-hand variable, property, or indexer. It can also be used with other arithmetic, Boolean logical, and bitwise operators.
Assignment (=):
example :
int x = 7;
x op= y
Compound assignment:
Example:
int x +=8;
int a *=6;
We have various Miscellaneous Operators in C# which we will discuss later ..)
Already discussed in Arithmetic operators. You can go to C#- Programming Guide | Starting Phase Learning(7)
Comparison are made in a statement using ? and :
Example:
int a = 5;
int b = 10;
a = b>a ? 0 : 1;
Others listed operators will see in detail the next phase of C# Learning
default operator
delegate operator
nameof operator
new operator
sizeof operator
stackalloc operator
true and false operators
Operator overloading
**In the next article, we will see the conditional statement and operator uses in a real-time project.
Mumbai, often referred to as the financial capital of India, is a hub for businesses and industries. With countless corporate…
When it comes to security services in Noida, there are several reputable companies that cater to various needs. Let me…
Are you tired of dealing with tooth decay, gum problems, and expensive dental treatments? Look no further! Steel Bite Pro…
In the world of fine jewelry, oval moissanite rings have emerged as a captivating choice for those seeking elegance and…
Noida, located in the state of Uttar Pradesh, is a fast-growing hub of digital marketing agencies in India. Choosing the…
As we move into 2023, the world of motorcycles in India is set to see some exciting changes. Manufacturers are…
Leave a Comment