There should be a compiler supported way in C# to declare a property with custom getter/setter logic without having to explicitly declare a backing field. In the absence of such a feature, if you want to have custom getter/setter logic you have to ditch automatic properties, declare a backing field explicitly and then there’s nothing stopping a future programmer from assigning directly to the backing field and the custom getter/setter logic not getting executed probably leading to bugs.
Update:Check out part 2 where I take an example to bring the problem into perspective and propose a solution…





If you make your backing field private then future programmer can not miss it. Isn’t it?
I was talking about a future programmer modifying the same class where the private backing field is declared.