Operators in C# – C# Programming Example
Basic General

Operators in C#

Operators in C# can be separated in several different categories:
Arithmetic operators: They are used to perform simple mathematical operations.
Assignment operators: Allow assigning values to variables.
Comparison operators: Allow comparison of two literals and/or variables.
Logical operators: Operators that work with Boolean data types and Boolean expressions.
Binary operators: Used to perform operations on the binary representation of numerical data.
Type conversion operators: Allow conversion of data from one type to another.

Operator Categories

Below is a list of the operators, separated into categories:

Types of Operators by Number of Arguments

Operators can be separated into different types according to the number of arguments they could take:

Example of Arithmetical Operators

C# Code:

Output:

 

Example of Logical Operators

C# Code:

Output:

 

Example of Bitwise Operators

C# Code:

 

Example of Comparison Operators

C# Code:

Example of Conditional Operator “?:”

C# Code:

Output:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: