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. |