-
Key Features and
Create a new project in Visual Studio 2022 - Naming Standards & Comments
- Data Types
- Variables and Constant Variable
- Conditional Statement
- Switch Conditional Statement
- Arithmetic, Comparison, Assignment and Logical Operators
- For, While and Do While Loops
- Importance of Break and Continue Keywords
- Strings and Important String Methods
- Single Dimensional Array
- Multi Dimensional Array
- Methods and Method Overloading
- Math Class and Functions
- Casting and Type Conversions
- Class and Objects
- Constructor, Parameter less and Parameterized Constructor
- Single, Multi level and Hierarchical Inheritance
- Compile Time Polymorphism, Method and Operator Overloading
- Run-time Polymorphism and Importance of base keyword
- Abstract Class and Method
- Interface and Multiple Inheritance through Interfaces
Agenda
- C# Operators
- Arithmetic Operators
- Comparison Operators
- Assignment Operators
- Logical Operators
C# Operators
Operator in C# is a symbol that is used to perform operations on variables and values. For example: +, -, *, / etc.
Important Categories of Operators:
a) Arithmetic Operators
- Addition + (for Addition, String concatenation)
- Subtraction – (for Subtraction)
- Multiplication *
- Division / (Divides the left operand by the right operand)
- Modules % (Computes the remainder after dividing its left operand by its right operand)
- Increment ++
- Decrement —
b) Comparison Operators (Comparison operators compare two operands and returns true or false)
- ==
- !=
- >
- >=
- <
- <=
c) Assignment Operators
- Assignment Operator: =
- Add and Assign: +=
- Subtract and assign: -=
- Multiply and assign: *=
- Divide and assign: /=
d) Logical Operators
- Logical Not Operator ! (Reverse the result, returns False if the result is true)
- Logical And Operator && (Returns True if both statements are true)
- Logical Or Operators || (Returns True if one of the statements is true)
int i = 50;
int j = 20;
Console.WriteLine(i+j);
Console.WriteLine(i - j);
Console.WriteLine(i * j);
Console.WriteLine(i / j);
Console.WriteLine(i % j);
Console.WriteLine(i++); //50
Console.WriteLine(i); //51
Console.WriteLine(++i); //52
Console.WriteLine(i); //52
int m = 10;
int n = 20;
Console.WriteLine(m == n);
Console.WriteLine(m != n);
Console.WriteLine(m > n);
Console.WriteLine(m >= n);
Console.WriteLine(m < n);
Console.WriteLine(m <= n);
int a = 10;
a += 5;
int b = 20;
b -= 10;
int c = 30;
c *= 5;
int d = 40;
d /= 5;
Console.WriteLine(a);
Console.WriteLine(b);
Console.WriteLine(c);
Console.WriteLine(d);
bool p, q;
p = true;
q = false;
Console.WriteLine(!p);
Console.WriteLine(p && q);
Console.WriteLine(p || q);
int x = 7;
Console.WriteLine(!(x > 5 && x < 10)); Console.WriteLine(x > 5 && x < 10); Console.WriteLine(x > 5 || x < 10);