static void Main() { int foo = 7; Bar b = new Bar(&foo); b.AddOne(); Console.WriteLine(foo); // prints 8 Console.ReadLine(); }