Well, the first and second both generate something like the third in the end. However, don't use the third when you have a syntax for properties.
Finally, if you have no work to do in the get
or set
, then use the first.
In the end, the first and second are just some form of syntactic sugar, but why code more than what's necessary.
// more code == more bugs
And just to have a little fun, consider this:
public string A { get; private set; }
Now that's a lot more straight forward isn't it? The public
modifier is implied on both the get
and the set
, but it can be overriden. This would of course be the same rule for any modifier used when defining the property itself.