Automatic properties let me replace this code:
private MyType myProperty;
public MyType MyProperty
{
get { return myPropertyField; }
}
No, unfortunately not. I would very much like the feature, which could look like this:
public readonly string Name { get; }
or (slightly oddly)
public readonly string Name { get; readonly set; }
This would be converted into something like:
private readonly string <>_Name;
public string Name { get { return <>_Name; } }
The twist is that setter calls would be allowed - but only within the constructor. Such calls would be converted directly into assignments to the backing field.
I would dearly, dearly love such a feature. Maybe for C# 5...