SlideShare a Scribd company logo
Learn C# Programming
Operators
Eng Teong Cheah
Microsoft MVP in Visual Studio &
Development Technologies
Agenda
•Operators
C# - Operators
C# - Operators
An operator is a symbol that tells the compiler to perform specific
mathematical or logical manipulations. C# has rich set of built-in
operators and provides the following type of operators:
• Arithmetic Operators
• Relational Operators
• Logical Operators
• Bitwise Operators
• Assignment Operators
• Misc Operators
C# - Operators
This tutorial explains the arithmetic, relational, logical,
bitwise, assignment, and other operators one by one.
C# - Operators
Arithmetic Operators
Following table shows all the arithmetic operators supported
by C#. Assume variable A holds 10 and variable B holds 20
then:
C# - Operators
Arithmetic Operators
Demo
C# - Operators
Relational Operators
Following table shows all the relational operators supported
by C#. Assume variable A holds 10 and variable B holds 20
then:
C# - Operators
Relational Operators
Demo
C# - Operators
Logical Operators
Following table shows all the logical operators supported by
C#. Assume variable A holds Boolean value true and variable
B holds Boolean value false:
C# - Operators
Logical Operators
Demo
C# - Operators
Bitwise Operators
Bitwise operator works on bits and perform bit by bit
operation. The truth tables for &, | , and ^ are as follows:
C# - Operators
Bitwise Operators
Assume if A = 60; and B=13; then in the binary format they are as
follows:
A = 0011 1100
B = 0000 1101
---------------------
A&B = 0000 1100
A|B = 0011 1101
A^B = 0011 0001
~A = 1100 0011
C# - Operators
Bitwise Operators
The Bitwise operators supported by C# are listed in the
following table. Assume variable A holds 60 and variable B
holds 13, then:
C# - Operators
Bitwise Operators
Demo
C# - Operators
Assignment Operators
There are following assignment
operators supported by C#:
Demo
C# - Operators
Miscellaneous Operators
There are few other
important operators
including sizeof , typeof
and ? : supported by C#
Demo
C# - Operators
Operators Precedence in C#
Operator precedence determines the grouping of terms in
an expression. This affects evaluation of an expression.
Certain operators have higher precedence than others; for
example, the multiplication operator has higher precedence
than the addition operator.
C# - Operators
Operators Precedence in C#
For example x = 7 + 3 * 2; here, x is assigned 13, not 20 because
operator * has higher precedence than +, so the first evaluation
takes place for 3*2 and then 7 is added into it.
Here, operators with the highest precedence appear at the top
of the table, those with the lowest appear at the bottom. Within
an expression, higher precedence operators are evaluated first.
C# - Operators
Operators Precedence in C#
Demo
Related Content
•TutorialsPoint
www.tutorialspoint.com
Thank You

More Related Content

PDF
Learn C# Programming - Variables & Constants
PDF
Learn C# Programming - Nullables & Arrays
PDF
Learn C# programming - Program Structure & Basic Syntax
PPT
Variables in C Programming
PPTX
datatypes and variables in c language
PPT
pointer, structure ,union and intro to file handling
PPT
Constants in C Programming
PDF
Learn C# Programming - Decision Making & Loops
Learn C# Programming - Variables & Constants
Learn C# Programming - Nullables & Arrays
Learn C# programming - Program Structure & Basic Syntax
Variables in C Programming
datatypes and variables in c language
pointer, structure ,union and intro to file handling
Constants in C Programming
Learn C# Programming - Decision Making & Loops

What's hot (20)

PPTX
What is identifier c programming
PPTX
Structure of c_program_to_input_output
PDF
Programming in C- Introduction
PDF
Python Programming
PPTX
Variables in C and C++ Language
PPTX
C Token’s
PPTX
C tokens
PPTX
C Tokens
PPT
Introduction to Basic C programming 01
PPTX
Unit 2. Elements of C
PPT
Declaration of variables
PPTX
Programming in C Presentation upto FILE
PPTX
Introduction of C#
PDF
Basic of the C language
DOC
C fundamental
PPT
C material
PPT
Literals,variables,datatype in C#
ODP
CProgrammingTutorial
What is identifier c programming
Structure of c_program_to_input_output
Programming in C- Introduction
Python Programming
Variables in C and C++ Language
C Token’s
C tokens
C Tokens
Introduction to Basic C programming 01
Unit 2. Elements of C
Declaration of variables
Programming in C Presentation upto FILE
Introduction of C#
Basic of the C language
C fundamental
C material
Literals,variables,datatype in C#
CProgrammingTutorial
Ad

Similar to Learn C# Programming - Operators (20)

PPTX
CSE113 (UNIT-2)Storage classes in the computer science.pptx
PPTX
Arithmetic and increment decrement Operator
PPTX
Operators in C#
PDF
Lecture 3
PPTX
Csc240 -lecture_5
PDF
C# Fundamentals - Basics of OOPS - Part 2
PDF
Module2.1_Programming_Branching_and_looping.pdf
PPTX
Java unit1 b- Java Operators to Methods
PDF
Constructor and destructors
PDF
Coper in C
PPTX
C sharp part 001
PPTX
Operators in c-1.pptxOperators in c-1.pptx
PPT
Operators and Expressions in C++
PPTX
OPERATORS IN C.pptx
PPTX
OPERATORS IN C.pptx
PPT
C Operators in programming langues .ppt
PPTX
Cse lecture-4.1-c operators and expression
PPTX
Operators and Expressions in C#
PPTX
Operators and it's type
PPTX
CSE113 (UNIT-2)Storage classes in the computer science.pptx
Arithmetic and increment decrement Operator
Operators in C#
Lecture 3
Csc240 -lecture_5
C# Fundamentals - Basics of OOPS - Part 2
Module2.1_Programming_Branching_and_looping.pdf
Java unit1 b- Java Operators to Methods
Constructor and destructors
Coper in C
C sharp part 001
Operators in c-1.pptxOperators in c-1.pptx
Operators and Expressions in C++
OPERATORS IN C.pptx
OPERATORS IN C.pptx
C Operators in programming langues .ppt
Cse lecture-4.1-c operators and expression
Operators and Expressions in C#
Operators and it's type
Ad

More from Eng Teong Cheah (20)

PDF
Modern Cross-Platform Apps with .NET MAUI
PDF
Efficiently Removing Duplicates from a Sorted Array
PDF
Monitoring Models
PDF
Responsible Machine Learning
PDF
Training Optimal Models
PDF
Deploying Models
PDF
Machine Learning Workflows
PDF
Working with Compute
PDF
Working with Data
PDF
Experiments & TrainingModels
PDF
Automated Machine Learning
PDF
Getting Started with Azure Machine Learning
PDF
Hacking Containers - Container Storage
PDF
Hacking Containers - Looking at Cgroups
PDF
Hacking Containers - Linux Containers
PDF
Data Security - Storage Security
PDF
Application Security- App security
PDF
Application Security - Key Vault
PDF
Compute Security - Container Security
PDF
Compute Security - Host Security
Modern Cross-Platform Apps with .NET MAUI
Efficiently Removing Duplicates from a Sorted Array
Monitoring Models
Responsible Machine Learning
Training Optimal Models
Deploying Models
Machine Learning Workflows
Working with Compute
Working with Data
Experiments & TrainingModels
Automated Machine Learning
Getting Started with Azure Machine Learning
Hacking Containers - Container Storage
Hacking Containers - Looking at Cgroups
Hacking Containers - Linux Containers
Data Security - Storage Security
Application Security- App security
Application Security - Key Vault
Compute Security - Container Security
Compute Security - Host Security

Recently uploaded (20)

PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Cloud computing and distributed systems.
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Encapsulation theory and applications.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Spectroscopy.pptx food analysis technology
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
MYSQL Presentation for SQL database connectivity
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPT
Teaching material agriculture food technology
Digital-Transformation-Roadmap-for-Companies.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Per capita expenditure prediction using model stacking based on satellite ima...
Cloud computing and distributed systems.
A comparative analysis of optical character recognition models for extracting...
Unlocking AI with Model Context Protocol (MCP)
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Encapsulation theory and applications.pdf
The AUB Centre for AI in Media Proposal.docx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Network Security Unit 5.pdf for BCA BBA.
Spectroscopy.pptx food analysis technology
20250228 LYD VKU AI Blended-Learning.pptx
Programs and apps: productivity, graphics, security and other tools
“AI and Expert System Decision Support & Business Intelligence Systems”
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
MYSQL Presentation for SQL database connectivity
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Teaching material agriculture food technology

Learn C# Programming - Operators

  • 1. Learn C# Programming Operators Eng Teong Cheah Microsoft MVP in Visual Studio & Development Technologies
  • 4. C# - Operators An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. C# has rich set of built-in operators and provides the following type of operators: • Arithmetic Operators • Relational Operators • Logical Operators • Bitwise Operators • Assignment Operators • Misc Operators
  • 5. C# - Operators This tutorial explains the arithmetic, relational, logical, bitwise, assignment, and other operators one by one.
  • 6. C# - Operators Arithmetic Operators Following table shows all the arithmetic operators supported by C#. Assume variable A holds 10 and variable B holds 20 then:
  • 9. C# - Operators Relational Operators Following table shows all the relational operators supported by C#. Assume variable A holds 10 and variable B holds 20 then:
  • 11. Demo
  • 12. C# - Operators Logical Operators Following table shows all the logical operators supported by C#. Assume variable A holds Boolean value true and variable B holds Boolean value false:
  • 14. Demo
  • 15. C# - Operators Bitwise Operators Bitwise operator works on bits and perform bit by bit operation. The truth tables for &, | , and ^ are as follows:
  • 16. C# - Operators Bitwise Operators Assume if A = 60; and B=13; then in the binary format they are as follows: A = 0011 1100 B = 0000 1101 --------------------- A&B = 0000 1100 A|B = 0011 1101 A^B = 0011 0001 ~A = 1100 0011
  • 17. C# - Operators Bitwise Operators The Bitwise operators supported by C# are listed in the following table. Assume variable A holds 60 and variable B holds 13, then:
  • 19. Demo
  • 20. C# - Operators Assignment Operators There are following assignment operators supported by C#:
  • 21. Demo
  • 22. C# - Operators Miscellaneous Operators There are few other important operators including sizeof , typeof and ? : supported by C#
  • 23. Demo
  • 24. C# - Operators Operators Precedence in C# Operator precedence determines the grouping of terms in an expression. This affects evaluation of an expression. Certain operators have higher precedence than others; for example, the multiplication operator has higher precedence than the addition operator.
  • 25. C# - Operators Operators Precedence in C# For example x = 7 + 3 * 2; here, x is assigned 13, not 20 because operator * has higher precedence than +, so the first evaluation takes place for 3*2 and then 7 is added into it. Here, operators with the highest precedence appear at the top of the table, those with the lowest appear at the bottom. Within an expression, higher precedence operators are evaluated first.
  • 26. C# - Operators Operators Precedence in C#
  • 27. Demo