 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are increment (++) and decrement (--) operators in C#?
Increment Operators
To increment a value in C#, you can use the increment operators i.e. Pre-Increment and Post-Increment Operators.
The following is an example −
Example
using System; class Demo {    static void Main() {       int a = 250;       Console.WriteLine(a);       a++;       Console.WriteLine(a);       ++a;       Console.WriteLine(a);       int b = 0;       b = a++;       Console.WriteLine(b);       Console.WriteLine(a);       b = ++a;       Console.WriteLine(b);       Console.WriteLine(a);    } } Decrement Operators
To decrement a value in C#, you can use the decrement operators i.e. Pre-Decrement and Post-Decrement Operators.
The following is an example −
Example
using System; class Demo {    static void Main() {       int a = 250;       Console.WriteLine(a);       a--;       Console.WriteLine(a);       --a;       Console.WriteLine(a);       int b = 0;       b = a--;       Console.WriteLine(b);       Console.WriteLine(a);       b = --a;       Console.WriteLine(b);       Console.WriteLine(a);    } }Advertisements
 