CSharp examples for Language Basics:Operator
Using the Increment and Decrement Unary Operators
class MainClass/*from w ww . jav a 2s.c o m*/ { static void Main() { int Val1 = 0; int Val2 = 0; System.Console.WriteLine("Val1 = {0} Val2 = {1}", Val1, Val2); System.Console.WriteLine("Val1 (Pre) = {0} Val2 = (Post) {1}", ++Val1, Val2++); System.Console.WriteLine("Val1 (Pre) = {0} Val2 = (Post) {1}", ++Val1, Val2++); System.Console.WriteLine("Val1 (Pre) = {0} Val2 = (Post) {1}", ++Val1, Val2++); } }