Swapping values between two variables without using temp variable.

There is an easy way to swapping values of two variables by using a temporary variable. But here am trying to get interchanged values between those variables without using any temporary variable. Just look in to this…


public int a = 10;

public int b = 20;


//Before swapping

textBox1.Text = a.ToString();

textBox2.Text = b.ToString();

//After swapping

a = a + b;

b = a - b;

a = a - b;

textBox1.Text = a.ToString();

textBox2.Text = b.ToString();

This has been coded in a windows application using C#.

…S.VinothkumaR.