Auto-Implemented Properties
C# 3.0 introduced a feature called auto-implemented properties to reduce the “syntactic ceremony” involved in creating “simple properties” that are nothing but smart fields. Instead of having to declare the backing field and a property accessing that field manually, the following syntax takes care of it all:
The preceding code is turned into this equivalent:
Although the accessibility of the generated get
and set
accessor ...
Get C# 4.0 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.