C# 7.0 is a version of the C# programming language that was released in 2017. It includes a number of new features and improvements.
Table of Contents
C# 7 Major Features
C# 7.0 introduces the ability to declare variables in the argument list of a method call, rather than declaring them separately.
C# 7.0 adds support for tuples, which allow you to group a set of related items and return them as a single object.
C# 7.0 introduces pattern matching, which allows you to check the structure of an object and bind variables to its components.
C# 7.0 adds the ability to define functions within the scope of another function, making it easier to organize your code.
Ref returns and locals
C# 7.0 allows you to return a reference to a local variable, and to declare variables that are references to other variables.
Improved expression-bodied members
C# 7.0 allows you to use expressions to define the bodies of methods, properties, and other members, making it easier to write concise code.
Generalized async return types
C# 7.0 allows you to use any type that has a suitable “GetAwaiter” method as the return type of an async method, making it easier to write asynchronous code.
C# 7.0 allows you to throw exceptions directly from expressions, rather than having to use a separate statement.
C# 7.0 introduces digit separators, which allow you to make large numbers more readable by separating groups of digits with underscores.
C# 7.0 adds support for binary literals, which allow you to represent binary numbers using the prefix “0b”.
Numeric literal syntax improvements
You can use underscores to make long numeric literals more readable.