Refinements that made generics and low-level code more usable.
This release added 7 features, each with a before-and-after example.
Features in C# 7.3
- Auto-implemented property field attributes - Allow attributes to be applied to the hidden backing field of auto-implemented properties.
- Enum and Delegate generic constraints - Constrain generic type parameters to
System.EnumorSystem.Delegate. - Expression variables in initializers - Use
out varand pattern variables in field initializers, constructor initializers, and LINQ queries. - Ref reassignment - Point an existing ref local or ref parameter at a different variable.
- Stackalloc array initializers - Initialize stackalloc arrays with inline values.
- Tuple equality operators - Compare tuples directly using
==and!=operators. - Unmanaged generic type constraints - Constrain generic types to unmanaged types only.