Example at belows show prefix and postfix increments in C#.
int x = 5;
Console.WriteLine("x: {0}", x); //Output x: 5
Console.WriteLine("x++: {0}", x++); // Output x: 5
Console.WriteLine("x: {0}", x); // Output x: 6
int x = 5;
Console.WriteLine("x: {0}", x); // Output x: 5
Console.WriteLine("++x: {0}", ++x); // Output x: 6
Console.WriteLine("x: {0}", x); // Output x: 6
Comments