Join Reynald Adolphe for an in-depth discussion in this video Using getter-only auto-properties, part of C# 6.0 First Look.
- Getter-only auto-properties are essentially…read-only properties that let you omit a setter,…leaving you with just the get.…And as a result, the backing field…of a getter-only auto-property becomes read-only.…And just like we just saw, we can also initialize it…with a value.…For example, for Name, we can add…"David Letterman" as an assignment,…and for the age, say 65.…
Now, this feature would only be important to you…if you care to control what's mutable and immutable…in your designs.…Mutable meaning objects whose state can be modified,…and immutable, objects whose state cannot.…When we first got auto-properties,…it was great and concise, but came at a cost.…They made your objects immutable.…But now, with getter-only auto-properties,…your class can remain immutable…and you can still get the convenience of the concise syntax…of an auto-property.…
- Introducing the new IDE in Visual Studio 2015
- Leveraging nameof expressions
- Using index initializers
- Using await in catch and finally blocks
- Using static
- Resolving conflict instance methods
Skill Level Beginner
1. Touring the Enhanced IDE
2. Expression-Level Features
3. Statement-Level Features
Adding exception filters2m 42s
4. Member Declaration and Initialization Features
5. Improved Debugging
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.