Let's talk about accessor's accessibility introduced in C# 2.0. This is a tiny little feature that can make your life easier in a number of ways. But first, let's define what i am talking about. Normally, a property is composed this way: So, from the example above, we can see that a property has a backfield (called _myProperty) and is composed by a getter and a setter . The getter is called whenever you get the value of that property. The setter is called when you set it's value. If we look carefully, we notice that the getter returns the value of the backfield, and the setter sets it's value, respectively. If we think about it, a property is nothing more than a wrapper around a private field. This way we can control all the access to that field's value. C#'s properties are nothing more than sintactic sugar for the following structure: This is an " old school property ". In languages where you don't really have the concept of prop...
Let's have some fun with programming...