static void Main() { RefTest ob = new RefTest(); int a = 10; Console.WriteLine("a before call: " + a); ob.Sqr(ref a); // notice the use of ref Console.WriteLine("a after call: " + a); }