C# – Properties & Events
Properties & Events
Section titled “Properties & Events”Property syntax evolved for terseness and correctness.
Feature map
Section titled “Feature map”Feature map (advanced)
Section titled “Feature map (advanced)”Comparison of property variants
Section titled “Comparison of property variants”| Variant | Introduced | Description |
|---|---|---|
| Basic properties | C# 1.0 | Manual getter/setter with explicit backing field. |
| Auto-implemented | C# 3.0 | Compiler-generated backing field. |
| Read-only (get-only) | C# 6.0 | Immutable after construction. |
| Auto-property initializers | C# 6.0 | Default values for auto-props. |
| Expression-bodied (get/set) | C# 6.0�7.0 | Concise accessors with =>. |
Init-only (init) | C# 9.0 | Settable only during initialization. |
| Required members | C# 11.0 | Enforce initialization in object creation. |
| Partial properties | C# 13.0 (preview) | Split accessors across partial types. |
field in accessors | C# 13.0 (preview) | Use implicit backing field inside accessors. |