4 ms·
I love the new read-only auto properties. 90% of the objects I write are immutable and it's a pain to declare all those private readonly backing fields just to
by cesarbs 12y ago
I love the new read-only auto properties. 90% of the objects I write are immutable and it's a pain to declare all those private readonly backing fields just to return them in getters.
- noblethrasher 12y agoAgreed, I hardly ever used auto-implemented properties for that reason. But, Is the backing field for a read-only auto-property still readonly (i.e. only assignable from within a constructor body)?
- icegreentea 12y agoYes, the backing field is readonly.
- zer0nes 12y agoWhy don't you use public readonly fields?
- seanmcdirmid 12y agoInterfaces and overriding usually.