What gets pushed onto the stack when an object is called by reference? Consider this code:
using System;
class em
{
public int i=0;
}
class program
{
public void method(int a, ref int b, em c, ref em d)
{
//implementation
}
static public void Main()
{
int i;
int j;
em e1 = new em();
em e2 = new em();
i=9;
j=10;
Program p=new Program();
p.method(i,ref j,e1,ref e2);
}
}
When e1 is passed , the reference of the object is passed as an argument but in this code when e2 is passed by reference, what is pushed onto the stack i.e., what is passed as the argument to the method ? And what is passed when the same object is returned using ref .