
Domains
Agile Management
Master Agile methodologies for efficient and timely project delivery.
View All Agile Management Coursesicon-refresh-cwCertifications
Scrum Alliance
16 Hours
Best Seller
Certified ScrumMaster (CSM) CertificationScrum Alliance
16 Hours
Best Seller
Certified Scrum Product Owner (CSPO) CertificationScaled Agile
16 Hours
Trending
Leading SAFe 6.0 CertificationScrum.org
16 Hours
Professional Scrum Master (PSM) CertificationScaled Agile
16 Hours
SAFe 6.0 Scrum Master (SSM) CertificationAdvanced Certifications
Scaled Agile, Inc.
32 Hours
Recommended
Implementing SAFe 6.0 (SPC) CertificationScaled Agile, Inc.
24 Hours
SAFe 6.0 Release Train Engineer (RTE) CertificationScaled Agile, Inc.
16 Hours
Trending
SAFe® 6.0 Product Owner/Product Manager (POPM)IC Agile
24 Hours
ICP Agile Certified Coaching (ICP-ACC)Scrum.org
16 Hours
Professional Scrum Product Owner I (PSPO I) TrainingMasters
32 Hours
Trending
Agile Management Master's Program32 Hours
Agile Excellence Master's ProgramOn-Demand Courses
Agile and ScrumRoles
Scrum MasterTech Courses and Bootcamps
Full Stack Developer BootcampAccreditation Bodies
Scrum AllianceTop Resources
Scrum TutorialProject Management
Gain expert skills to lead projects to success and timely completion.
View All Project Management Coursesicon-standCertifications
PMI
36 Hours
Best Seller
Project Management Professional (PMP) CertificationAxelos
32 Hours
PRINCE2 Foundation & Practitioner CertificationAxelos
16 Hours
PRINCE2 Foundation CertificationAxelos
16 Hours
PRINCE2 Practitioner CertificationSkills
Change ManagementMasters
Job Oriented
45 Hours
Trending
Project Management Master's ProgramUniversity Programs
45 Hours
Trending
Project Management Master's ProgramOn-Demand Courses
PRINCE2 Practitioner CourseRoles
Project ManagerAccreditation Bodies
PMITop Resources
Theories of MotivationCloud Computing
Learn to harness the cloud to deliver computing resources efficiently.
View All Cloud Computing Coursesicon-cloud-snowingCertifications
AWS
32 Hours
Best Seller
AWS Certified Solutions Architect - AssociateAWS
32 Hours
AWS Cloud Practitioner CertificationAWS
24 Hours
AWS DevOps CertificationMicrosoft
16 Hours
Azure Fundamentals CertificationMicrosoft
24 Hours
Best Seller
Azure Administrator CertificationMicrosoft
45 Hours
Recommended
Azure Data Engineer CertificationMicrosoft
32 Hours
Azure Solution Architect CertificationMicrosoft
40 Hours
Azure DevOps CertificationAWS
24 Hours
Systems Operations on AWS Certification TrainingAWS
24 Hours
Developing on AWSMasters
Job Oriented
48 Hours
New
AWS Cloud Architect Masters ProgramBootcamps
Career Kickstarter
100 Hours
Trending
Cloud Engineer BootcampRoles
Cloud EngineerOn-Demand Courses
AWS Certified Developer Associate - Complete GuideAuthorized Partners of
AWSTop Resources
Scrum TutorialIT Service Management
Understand how to plan, design, and optimize IT services efficiently.
View All DevOps Coursesicon-git-commitCertifications
Axelos
16 Hours
Best Seller
ITIL 4 Foundation CertificationAxelos
16 Hours
ITIL Practitioner CertificationPeopleCert
16 Hours
ISO 14001 Foundation CertificationPeopleCert
16 Hours
ISO 20000 CertificationPeopleCert
24 Hours
ISO 27000 Foundation CertificationAxelos
24 Hours
ITIL 4 Specialist: Create, Deliver and Support TrainingAxelos
24 Hours
ITIL 4 Specialist: Drive Stakeholder Value TrainingAxelos
16 Hours
ITIL 4 Strategist Direct, Plan and Improve TrainingOn-Demand Courses
ITIL 4 Specialist: Create, Deliver and Support ExamTop Resources
ITIL Practice TestData Science
Unlock valuable insights from data with advanced analytics.
View All Data Science Coursesicon-dataBootcamps
Job Oriented
6 Months
Trending
Data Science BootcampJob Oriented
289 Hours
Data Engineer BootcampJob Oriented
6 Months
Data Analyst BootcampJob Oriented
288 Hours
New
AI Engineer BootcampSkills
Data Science with PythonRoles
Data ScientistOn-Demand Courses
Data Analysis Using ExcelTop Resources
Machine Learning TutorialDevOps
Automate and streamline the delivery of products and services.
View All DevOps Coursesicon-terminal-squareCertifications
DevOps Institute
16 Hours
Best Seller
DevOps Foundation CertificationCNCF
32 Hours
New
Certified Kubernetes AdministratorDevops Institute
16 Hours
Devops LeaderSkills
KubernetesRoles
DevOps EngineerOn-Demand Courses
CI/CD with Jenkins XGlobal Accreditations
DevOps InstituteTop Resources
Top DevOps ProjectsBI And Visualization
Understand how to transform data into actionable, measurable insights.
View All BI And Visualization Coursesicon-microscopeBI and Visualization Tools
Certification
24 Hours
Recommended
Tableau CertificationCertification
24 Hours
Data Visualization with Tableau CertificationMicrosoft
24 Hours
Best Seller
Microsoft Power BI CertificationTIBCO
36 Hours
TIBCO Spotfire TrainingCertification
30 Hours
Data Visualization with QlikView CertificationCertification
16 Hours
Sisense BI CertificationOn-Demand Courses
Data Visualization Using Tableau TrainingTop Resources
Python Data Viz LibsCyber Security
Understand how to protect data and systems from threats or disasters.
View All Cyber Security Coursesicon-refresh-cwCertifications
CompTIA
40 Hours
Best Seller
CompTIA Security+EC-Council
40 Hours
Certified Ethical Hacker (CEH v12) CertificationISACA
22 Hours
Certified Information Systems Auditor (CISA) CertificationISACA
40 Hours
Certified Information Security Manager (CISM) Certification(ISC)²
40 Hours
Certified Information Systems Security Professional (CISSP)(ISC)²
40 Hours
Certified Cloud Security Professional (CCSP) Certification16 Hours
Certified Information Privacy Professional - Europe (CIPP-E) CertificationISACA
16 Hours
COBIT5 Foundation16 Hours
Payment Card Industry Security Standards (PCI-DSS) CertificationOn-Demand Courses
CISSPTop Resources
Laptops for IT SecurityWeb Development
Learn to create user-friendly, fast, and dynamic web applications.
View All Web Development Coursesicon-codeBootcamps
Career Kickstarter
6 Months
Best Seller
Full-Stack Developer BootcampJob Oriented
3 Months
Best Seller
UI/UX Design BootcampEnterprise Recommended
6 Months
Java Full Stack Developer BootcampCareer Kickstarter
490+ Hours
Front-End Development BootcampCareer Accelerator
4 Months
Backend Development Bootcamp (Node JS)Skills
ReactOn-Demand Courses
Angular TrainingTop Resources
Top HTML ProjectsBlockchain
Understand how transactions and databases work in blockchain technology.
View All Blockchain Coursesicon-stop-squareBlockchain Certifications
40 Hours
Blockchain Professional Certification32 Hours
Blockchain Solutions Architect Certification32 Hours
Blockchain Security Engineer Certification24 Hours
Blockchain Quality Engineer Certification5+ Hours
Blockchain 101 CertificationOn-Demand Courses
NFT Essentials 101: A Beginner's GuideTop Resources
Blockchain Interview QsProgramming
Learn to code efficiently and design software that solves problems.
View All Programming Coursesicon-codeSkills
Python CertificationInterview Prep
Career Accelerator
3 Months
Software Engineer Interview PrepOn-Demand Courses
Data Structures and Algorithms with JavaScriptTop Resources
Python TutorialOperators are used to perform mathematical or logical manipulations in a program. There are many types of built-in operators in C#. Some of these are the following: Arithmetic Operators, Relational Operators, Logical Operators, Bitwise Operators, etc.
Details about all these operators are given as follows:
Arithmetic operators are used to perform arithmetic operations such as addition, subtraction, multiplication, division etc.
A table that shows all the arithmetic operators in C# is as follows:
Operator Name | Operator | Operator Description |
|---|---|---|
Addition Operator | + | This operator adds two operands |
Subtraction Operator | - | This operator subtracts the second operand from the first |
Multiplication Operator | * | This operator multiplies two operands |
Division Operator | / | This operator divides the numerator by the denominator |
Modulus Operator | % | This operator provides the remainder of a division operation. |
Increment Operator | ++ | This operator increments the integer value by one. |
Decrement Operator | -- | This operator decrements the integer value by one. |
Table: Arithmetic Operators in C#
A program that demonstrates the arithmetic operators in C# is as follows:
using System;
namespace ArithmeticOperators {
public class Example {
public static void Main(string[] args) {
int a, b;
a = 10;
b = 5;
Console.WriteLine("Arithmetic Operators in C#\n");
Console.WriteLine("Value of a: {0} ", a);
Console.WriteLine("Value of b: {0} \n", b);
// performing operations
Console.WriteLine("Addition of a and b: {0} ", a + b);
Console.WriteLine("Subtraction of a and b: {0} ", a - b);
Console.WriteLine("Multiplication of a and b: {0} ", a * b);
Console.WriteLine("Division of a and b: {0} ", a / b);
Console.WriteLine("Modulus of a and b: {0} ", a % b);
Console.WriteLine("Increment of a: {0} ", ++a);
Console.WriteLine("Decrement of b: {0} ", --b);
}
}
}
Source Code: Program to implement arithmetic operators in C#
The output of the above program is as follows:
Arithmetic Operators in C#
Value of a: 10
Value of b: 5
Addition of a and b: 15
Subtraction of a and b: 5
Multiplication of a and b: 50
Division of a and b: 2
Modulus of a and b: 0
Increment of a: 11
Decrement of b: 4
Relational Operators are used for comparison purposes. This includes finding if a variable is greater than another variable, lesser than another variable etc.
This table shows all the relational operators in C#:
Operator Name | Operator | Operator Description |
|---|---|---|
Equality Comparison Operator | == | This operator checks if the values of the two operands are equal. If they are, then the condition is true. |
Inequality Operator | != | This operator checks if the values of two operands are not equal. If they are not, then the condition is true. |
Greater than Operator | > | This operator checks if the value of the left operator is greater than the value of right operator. If it is, then the condition is true. |
Less than Operator | < | This operator checks if the value of the left operator is lesser than the value of right operator. If it is, then the condition is true. |
Greater than Equal to Operator | >= | This operator checks if the value of the left operator is greater than or equal to the value of right operator. If it is, then the condition is true. |
Less than Equal to Operator | <= | This operator checks if the value of the left operator is lesser than or equal to the value of right operator. If it is, then the condition is true. |
Table: Relational Operators in C#
A program that demonstrates the relational operators in C# is as follows:
using System;
namespace RelationalOperators {
public class Example {
public static void Main(string[] args) {
int a, b;
a = 5;
b = 10;
Console.WriteLine("Relational Operators in C#\n");
if (a == b)
Console.WriteLine("{0} and {1} are equal", a, b);
else if (a != b)
Console.WriteLine("{0} and {1} are not equal", a, b);
if (a > b)
Console.WriteLine("{0} is greater than {1}", a, b);
else if (a < b)
Console.WriteLine("{0} is less than {1}", a, b);
if (a >= b)
Console.WriteLine("{0} is greater than or equal to {1}", a, b);
else if (a <= b)
Console.WriteLine("{0} is less than or equal to {1}", a, b);
}
}
}
Source Code: Program to implement relational operators in C#
The output of the above program is as follows:
Relational Operators in C#
5 and 10 are not equal
5 is less than 10
5 is less than or equal to 10
The logical operators are used to perform specific logical operations in c#. There are three logical operators namely, logical AND, logical OR and logical NOT.
A table that shows all the logical operators in C# is as follows:
Operator Name | Operator | Operator Description |
|---|---|---|
Logical AND | && | If both the operands are non-zero then the condition evaluates to true otherwise it is false. |
Logical OR | || | If both the operands are zero then the condition evaluates to false otherwise it is true. |
Logical NOT | ! | This makes the operand true if it is false and false if it is true. |
Table: Logical Operators in C#
A program that demonstrates the logical operators in C# is as follows:
using System;
namespace LogicalOperators {
public class Example {
public static void Main(string[] args) {
int a = 5, b = 10, c = 1, d = 0;
bool val = false;
Console.WriteLine("Logical Operators in C#\n");
if ((a > b) && (c > d))
Console.WriteLine("{0} is greater than {1} and {2} is greater than {3}", a, b, c, d);
if ((a > b) || (c > d))
Console.WriteLine("{0} is greater than {1} or {2} is greater than {3}", a, b, c, d);
if (!val)
Console.WriteLine("Value of d is false");
else
Console.WriteLine("Value of d is true");
}
}
}
Source Code: Program to implement logical operators in C#
The output of the above program is as follows:
Logical Operators in C#
5 is greater than 10 or 1 is greater than 0
Value of d is false
The bitwise operators work at the level of bits and perform bit-by-bit operation. There are many bitwise operators such as bitwise AND, bitwise OR, bitwise XOR, bitwise NOT etc.
A table that shows all the bitwise operators in C# is as follows:
Operator Name | Operator | Operator Description |
|---|---|---|
Bitwise AND | & | This performs AND operation at bit level and copies 1 into the result if it is in both the operands. |
Bitwise OR | | | This performs OR operation at bit level and copies 0 into the result if it is in both the operands. |
Bitwise XOR | ^ | This performs XOR operation at bit level and copies 1 into the result if it is in one of the operands only. |
Bitwise COMPLEMENT | ~ | This converts the 1 into 0 and 0 into 1 in the operand. |
Bitwise Left Shift Operator | << | This shifts the left operand bits to the left by the value specified by the right operand. |
Bitwise Right Shift Operator | >> | This shifts the left operand bits to the right by the value specified by the right operand. |
Table: Bitwise Operators in C#
A program that demonstrates the bitwise operators in C# is as follows:
using System;
namespace BitwiseOperators {
public class Example {
public static void Main(string[] args) {
int a = 4, b = 14;
Console.WriteLine("Bitwise Operators in C#\n");
// a=0100 b=1110, therefore result a&b=0100
Console.WriteLine("Bitwise AND of {0} and {1} is {2}", a, b, a & b);
// a=0100 b=1110, therefore result a|b=1110
Console.WriteLine("Bitwise OR of {0} and {1} is {2}", a, b, a | b);
// a=0100 b=1110, therefore result a^b=1010
Console.WriteLine("Bitwise XOR of {0} and {1} is {2}", a, b, a ^ b);
// a=0100, therefore result ~a=1011,
Console.WriteLine("Bitwise NOT of {0} is {1}", a, ~a);
// a=0100 a<<1=1000
Console.WriteLine("Bitwise Left Shift of {0} by 1 position is {1}", a, a << 1);
// a=0100 a>>1=0010
Console.WriteLine("Bitwise Right Shift of {0} by 1 position is {1}", a, a >> 1);
}
}
}
Source Code: Program to implement bitwise operators in C#
The output of the above program is as follows:
Bitwise Operators in C#
Bitwise AND of 4 and 14 is 4
Bitwise OR of 4 and 14 is 14
Bitwise XOR of 4 and 14 is 10
Bitwise NOT of 4 is -5
Bitwise Left Shift of 4 by 1 position is 8
Bitwise Right Shift of 4 by 1 position is 2
The assignment operators in C# are used to assign values to variables. There are various shorthand’s to assign values.
This table shows all the assignment operators in C#:
Operator Name | Operator | Operator Description |
|---|---|---|
Assignment Operator | = | This operator assigns the values from the right side to the left side operand. |
Addition Assignment Operator | += | This operator adds the value of the right operand to left operand and stores it in the left operand. |
Subtraction Assignment Operator | -= | This operator subtracts the value of the right operand from the left operand and stores it in the left operand. |
Multiplication Assignment Operator | *= | This operator multiplies the value of the right operand to left operand and stores it in the left operand. |
Division Assignment Operator | /= | This operator divides the value of the right operand from the left operand and stores it in the left operand. |
Remainder Assignment Operator | %= | This operator uses modulus operator using two operands and the result is assigned to the left operand. |
Table: Assignment Operators in C#
A program that demonstrates the assignment operators in C# is as follows:
using System;
namespace AssignmentOperators {
public class Example {
public static void Main(string[] args) {
int a = 10, b = 4;
Console.WriteLine("Assignment Operators in C#\n");
a += b;
Console.WriteLine("Value of a is {0}", a);
a -= b;
Console.WriteLine("Value of a is {0}", a);
a *= b;
Console.WriteLine("Value of a is {0}", a);
a /= b;
Console.WriteLine("Value of a is {0}", a);
a %= b;
Console.WriteLine("Value of a is {0}", a);
}
}
}
Source Code: Program to implement assignment operators in C#
The output of the above program is as follows:
Assignment Operators in C#
Value of a is 14
Value of a is 10
Value of a is 40
Value of a is 10
Value of a is 2
There are many miscellaneous operators in C# such as sizeof(), & (address specifier),* (pointer dereference), ?: (conditional expression) etc.
A table that shows all the miscellaneous operators in C# is as follows:
Operator Name | Operator | Operator Description |
|---|---|---|
Sizeof Operator | sizeof() | This operator returns the size of a data type. |
Reference Operator | * | This is used to create a pointer to a variable. |
Address Specifier | & | This operator returns the address of a variable. |
Conditional Expression | ?: | This is used as a conditional statement. |
Table: Miscellaneous Operators in C#
A program that demonstrates different miscellaneous operators in C# is as follows:
using System;
namespace MiscellaneousOperators {
public class Example {
public static void Main(string[] args) {
int a = 10, b = 4, c;
Console.WriteLine("Miscellaneous Operators in C#\n");
// Usage of sizeof()
Console.WriteLine("Size of int variable is {0}", sizeof(int));
// Usage of Conditional Expression
c = (a > b) ? a : b;
Console.WriteLine("{0} is greater between {1} and {2}", c, a, b);
}
}
}
Source Code: Program to implement miscellaneous operators in C#
The output of the above program is as follows:
Miscellaneous Operators in C#
Size of int variable is 4
10 is greater between 10 and 4
Operator precedence specifies the order in which operators will be evaluated. Some operators have more precedence than others have and are evaluated first. In the table given below, the operators with the higher precedence are given at the top and the precedence decreases further down the table.
Category | Operator | Associativity |
|---|---|---|
Postfix | () [] -> . | Left to Right |
Unary | ! ~ ++ -- sizeof() & * + - | Right to Left |
Multiplicative | / % * | Left to Right |
Additive | - + | Left to Right |
Shift | << >> | Left to Right |
Relational | < <= > >= | Left to Right |
Equality | == != | Left to Right |
Bitwise AND | & | Left to Right |
Bitwise xOR | ^ | Left to Right |
Bitwise OR | | | Left to Right |
Logical AND | && | Left to Right |
Logical OR | || | Left to Right |
Conditional | ?: | Right to Left |
Assignment | = += -= *= /= %= | Right to Left |
Comma | , | Left to Right |
Table: Operator Precedence in C#