Switch Case in C#

Learn switch case in C# language with simple explanation, doubts and code example. Switch case statement in C# is also conditional statement. In switch condition e.g. switch(value), the value of variable is matched to case written in it body. Whatever case matches the value of variable, that block get executed and exit from the switch … Read more

If Else in C# – Includes If-Else Ladder

Learn if else in C# including if else ladder and nested if else conditional statements with simple explanation and program example. If else in C# programming is a decision-making statement / condition followed by a code block that is used in the program. Depending on evaluation of Boolean expression or conditions to true or false, … Read more

Ternary operator in C#

Ternary operator C# example-Learn how to compare two values using ternary operator (? : ) and how to execute the statement with explanation and example programs. When ever we want to compare 2 values, we can do with the if else statement as shown below. if(a>b) { Console.WriteLine(“A is greater than B”); } else { … Read more

Unary Operators in C#

Unary operators in C# language is used to increment / decrement the value of a variable or to negate the value of a Boolean variable / Expression etc. Unary operator is performed on only one operand / variable. Sounds difficult, in fact it’s very easy…Keep reading!!! We are going to learn about below unary operators … Read more

Logical operators in C#

Generally, logical operators in C# language e.g. &&, || (Logical AND and Logical OR respectively) are used to evaluate an expression to Boolean if they are true or false. They are used to control program flow and, generally used in if condition or while or for loops etc. Let’s make it simple with example && … Read more

Arithmetic operators in C#

Learn about arithmetic operators in C# programming i.e. + plus, – minus, * multiplication, /division and % modulo operators with simple example and explanation. Below are the arithmetic operators in C# language that are used to perform arithmetic operations on primitive data types i.e. int, float and double etc in C#. + Plus – Minus/Subtraction … Read more

Relational operators in C#

Relational operators in C# – Relational operators in C# language e.g. equal, greater than or less than etc. are used to check the relationship between two variables or expressions. It is also known as comparison operators in C# programming. For example, If int a =10 and int b =20; Then, we car write a relation … Read more

Assignment operators in C#

Assignment operators in C#- Learn about assignment operator in C# with example and easy explanation. Also, learn assignment operator combined with arithmetic operators in C# like +=, *= etc. with example. = Assignment operator in C# Assignment operator in C# program is used to assign a value to a variable. For example, int a = … Read more

Operators in C#

Learn about operators in C# with examples and simple explanations with code. What is operators in C#? Operators are special symbols that are used to perform operations on one or more operands in C# programming. Generally, these operators are applied on primitive data types in C# e.g. int, float and double etc. Operands example – … Read more

Getting Input from User / Keyboard in C#

Getting Input from User / Keyboard in C# – Learn how to get input from user / keyboard like int, string and double data types etc in C# program. Example of taking integer / string input using Console.ReadLine method in C#. To get the input from user, we use predefined Console.ReadLine method. Console.ReadLine-Read complete string … Read more