Tuples, pattern matching, local functions, out variables and ref returns.
This release added 12 features, each with a before-and-after example.
Features in C# 7.0
- Binary literals - Allow numeric literals to be written in binary.
- Deconstruction - Extract tuple and property values from objects.
- Digit separators - Allow numeric literals to contain the
_character as a visual aid. - Discards - Signal that values are intentionally being ignored.
- Expanded expression bodied members - Allow the
=>syntax for constructors, finalizers, and get/set accessors. - Local function statements - Allow functions to be declared inside other functions.
- Out variables - Declare out parameters inline.
- Pattern matching - Pattern match expressions for type and value checking.
- Ref local variable - Create a reference to the original value.
- Ref return - Return references to variables instead of copies of values.
- Throw expressions - Throw exceptions in more convenient ways.
- Tuples - Group multiple values without creating a dedicated type.