Syntactic suger runs many languages: "for(s1; e; s2) s3;" is syntactic
sugar for "s1; while(e) { s3; s2; }", but very usefull.
The "using(T t = e) { s1;...;sN; }" is (almost, since it can also uses
Close()) syntactic sugar for "T t = t; try { s1;...;sN; } finally {
t.Dispose(); }"
They provide a way to declare "fields" in interfaces, (like .Count)
They provide a way to just declare a public field right now, you can
always add some code to verify the updates of the field later without
changing the syntax of the code using the field.
Also, the type-system on them is a bit different than on get/set, since
a property is "one" entity and get/set are two functions with separate
types.
This is importent when declaring interfaces:
interface Foo { int i { get; } }
Declares an interface where NO implementation of Foo can have a "set"
part for i. While this is not really a usefull restriction declare, it
is a rather annoying restriction to have applied to ones classes
A (slightly confusing maybe) workaround for the restriction is:
class Bar: Foo
{
int Foo.i { get { return i; } }
public int i { get { ... } set { ...} }
}
Which lets people set i with "bar.i = 5" if they know bar as an instance
of Bar, but not if they know it as Foo.