Inside my .NET classes I access my properties and members through this. What is the difference if I access them without using this.
public class Test
{
private string _test;
public Test()
{
this.Test = "test";
// vs.
Test = "test";
// and
this._test = "test";
// vs.
_test = "test";
}
public string Test { get; set; }
}
There's no difference for the compiler at all. Use whatever is more readable. I prefer using this to show that this is a field/property instead of a local variable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With