On Nov 5, 3:57 pm, Satish Itty <sittyNOS...@cl ayton.comwrote:
What is the advantage of the new auto implemented properties introduced
in ocras?
They're a really easy way to implement trivial properties.
For example is there any difference between
public string Message;
and
public string Message {get;set;}
Yes - the latter creates a public property backed by a private field.
The former creates a public field. Making a *field* public is usually
a bad idea - it's an implementation detail which is better hidden in
the API with a property to expose it. That way if you need extra
validation, or to store the field in a different form somehow, you can
still expose the same API even while the underlying implementation (in
terms of storage) changes.
Jon