> I don't mind missing default values too much. I just don't like the
> fact that you can't make readonly automatic properties.
> > I don't mind missing default values too much. I just don't like the
> > fact that you can't make readonly automatic properties.
[quoted text clipped - 11 lines]
>
> public int Foo { get; protected set; }
Well, it's readonly from outside the class - but:
1) It doesn't stop the code within the class from accidentally setting
the property when it shouldn't
2) It means the backing variable can't be marked readonly, which may
prevent some JIT optimisations.
I would rather have real, true readonly-ness, where the property could
only be set in the constructor (the same as a readonly variable).
> And the same would apply to writeonly properties as well.
I'm not as worried about those :)

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
Gregg Walker - 05 Mar 2008 19:29 GMT
John --
> I would rather have real, true readonly-ness, where the property could
> only be set in the constructor (the same as a readonly variable).
Agreed.
>> And the same would apply to writeonly properties as well.
>
> I'm not as worried about those :)
LOL. My sentiments as well.
--
Gregg Walker