 Foo foo = new Foo();
int r = foo.Bar(7, 2);

Console.WriteLine(r);


See also

One can explicitly make arguments be passed by reference when calling a method with parameters preceded by keywords or .These managed pointers come in handy when passing variables that you want to be modified inside the method by reference.The main difference between the two is that an parameter must have been assigned within the method by the time the method returns, while ref need not assign a value.