C#- Programming Guide | Starting Phase Learning(6)

Spread the love

Operators in C#

Operators in C# are some special symbols used to perform operations on variables and values.
Let’s get into the mathematics to know better about it.

Addition we have
9 +9 = 18 //Addition (+)
2+17 = 19 //Addition (+)
30-20=10 //Subtarction (-)
24 = 8 //Multipliaction (*)
5 /5=1 //Division (/)

Seeing above, we have different symbol to represent the addition , subtraction etc.These special symbols in C# are called Operators.

Let’s take an example
int a = 8;
int b= a + 3;
int c = a+b;
int d = c* a;
The above operators are called arithmetic operators.

Similarly, there are different types of operators in C# which are used widely while developing the application.

Types of operators

  1. Arithmetic Operators
  2. Relational Operators
  3. Logical Operators
  4. Bitwise Operators
  5. Assignment Operators
  6. Misc Operators
  7. Member Access Operators
  8. Ternary Operators
  9. Type-cast operators
Types of Operators

Apart from these we also will discuss some other special operators in our upcoming learning phase like
default operator
delegate operator
nameof operator
new operator
sizeof operator
stackalloc operator
true and false operators
Operator overloading

1.Arithmetic Operators

Arithmetic operators are used to perform common mathematical operations:

The following operators perform arithmetic operations with operands of numeric types:

Unary Operators:

Increement (++) and decreement(–)
We will discuss more(i.e how to use ) in the next learning phase, <a href=””C#- Programming Guide | Starting Phase Learning(7)

Binary operators:

  • Addition
  • Subtraction
  • Multiplication
  • Division
  • % Modulus

C#- Programming Guide | Starting Phase Learning(7)

Leave a Reply

Your email address will not be published. Required fields are marked *