Mega Code Archive

 
Categories / C# Tutorial / Operator
 

The shortcut operators

class MainClass {   public static void Main()   {     int length = 1;     length += 10;     System.Console.WriteLine("length = " + length);     length *= 2;  // multiplies length by 2     System.Console.WriteLine("length = " + length);     length /= 3;  // divides length by 3     System.Console.WriteLine("length = " + length);   } } length = 11 length = 22 length = 7