readonly struct, in parameters, ref struct and the other low-level building blocks.
This release added 8 features, each with a before-and-after example.
Features in C# 7.2
- Conditional ref expressions - Use the conditional operator with ref returns and ref locals.
- In parameter modifiers - Pass parameters by reference without allowing modifications.
- Non-trailing named arguments - Use named arguments in any position when positional arguments follow.
- Numeric literal leading underscores - Allow underscores to be used before the first digit in a numeric literal.
- Private protected access modifier - Restrict access to derived types within the same assembly.
- readonly struct - Declare immutable value types that cannot be modified after creation.
- ref readonly method returns - Return references that cannot be modified by the caller.
- ref struct - Declare stack-only value types that cannot be allocated on the heap.