News for hackers. Stuff that matters.
Re:What's New in C# 6.0 [video] by cesarbs on Friday November 14, 2014 @01:45PM (#8608757)
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.
Re:What's New in C# 6.0 [video] by noblethrasher on Friday November 14, 2014 @02:23PM (#8608966)
Agreed, 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)?
Re:What's New in C# 6.0 [video] by icegreentea on Friday November 14, 2014 @05:18PM (#8609846)
Yes, the backing field is readonly.
Re:What's New in C# 6.0 [video] by zer0nes on Friday November 14, 2014 @07:48PM (#8610425)
Why don't you use public readonly fields?
Re:What's New in C# 6.0 [video] by seanmcdirmid on Friday November 14, 2014 @09:06PM (#8610608)
Interfaces and overriding usually.