In VBA, I constantly passed class instances as parameters to their own methods if I was going to be modifying their property values. To give an extremely simplified C# example:
class WhateverClass
{
public void DoSomething(WhateverClass whateverClass)
{
whateverClass.WhateverProperty = "Hello"
}
}
In C#, can I avoid needing to pass called class instances as parameters by using this
, like so? Or will this
refer to the default class instance?
class WhateverClass
{
public void DoSomething()
{
this.WhateverProperty = "Hello"
}
}