I would like someone to clarify what is the advantage of using C# 6 getter only auto properties vs using a public readonly field? Aren't they both public and equally immutable?
Asked
Active
Viewed 162 times
0
-
4Its is the same difference between a property and a field in general. See this: http://stackoverflow.com/questions/295104/what-is-the-difference-between-a-field-and-a-property-in-c – Yacoub Massad Feb 16 '16 at 02:44
-
As a whole Property is better than Field, way better, but there are a lot special scenarios where either of them will work and does not provide much improvements than the other. Such as this one. In this case, there is no difference. – brainless coder Feb 16 '16 at 02:56
-
@YacoubMassad I found a link to a Jon Skeet article where he explains the difference in depth in the question that you mentioned. Thanks. – ayoubj Feb 16 '16 at 03:38