G
Guest
Is there or should there be a simplified property syntax?
For example we have to write:
class MyClass {
private int _field;
public int Field { get { return _field;} set { _field=value}}
}
What if instead you could write:
class MyClass {
public property int Field;
}
Is something like this syntax available? If not should it be? It seems this
is much cleaner and prevents forcing writing a backing store for each
property seperately.
The benefit of this is cleaner coding for properties that just use a backing
field, plus compatibility to later change the implementation for that field
if needed without breaking the interface.
For example we have to write:
class MyClass {
private int _field;
public int Field { get { return _field;} set { _field=value}}
}
What if instead you could write:
class MyClass {
public property int Field;
}
Is something like this syntax available? If not should it be? It seems this
is much cleaner and prevents forcing writing a backing store for each
property seperately.
The benefit of this is cleaner coding for properties that just use a backing
field, plus compatibility to later change the implementation for that field
if needed without breaking the interface.