So I have a pretty simple class with an Id
field, and the Id
can be set in the constructor.
Typically I will use this
to clearly identify the class property as opposed to the method argument. To me this seems clearer.
IDE0003 wants me to remove the this
, with the message 'Name can be simplified', is that correct?
This seems less clear to me, and also allows a casing error to easily result in id = id
.
This other question has an answer that says you can configure the editor to remove the behavior. Personally I like "this"
Tools > Options > Text Editor > C# > Code Style and check Qualify member access with 'this'
Visual Studio 2015 - Change Light Bulb, Quick Action settings
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