I am developing a level editor in Xna and my question is that when you call a method using “this” as a param is the param a reference or a value?
Ex:
class A_Class
{
private B_Class bClass;
public void aMethod()
{
bClass.bMethod(this);
}
}
class B_Class
{
public void bMethod(A_Class aClass)
{
// code
}
}
It is a reference to the calling A_Class object, because classes are reference-type.
More specifically, as noted in other questions on reference/value, it is passing a value, and that value is a reference to the calling A_Class object.
If rather than A_Class, it was A_Struct,
thiswould be passed by value, as Structs are value-type.