What’s New in C# 7.0

[)roi(]

Executive Member
Joined
Apr 15, 2005
Messages
6,282
C# 7.0 adds a number of new features and brings a focus on data consumption, code simplification and performance. Perhaps the biggest features are tuples, which make it easy to have multiple results, and pattern matching which simplifies code that is conditional on the shape of data. But there are many other features big and small. We hope that they all combine to make your code more efficient and clear, and you more happy and productive.

Highlights:
  • Simplified syntax and enhanced Tuples application, including named Tuple Types, Tuple Literal and Deconstruction
  • Out variables
  • Pattern matching
  • Is-expressions with patterns
  • Switch statements with patterns
  • Local functions (functions within functions)
  • Literal improvements (for code readability, you can now use _ e.g. 1_000_000
  • Ref returns and locals (return by reference)
  • Generalized async return types
  • More expression bodied members
  • Throw expressions
Looks like someone has been looking at Rust and Swift -- so much too love about the new proposed enhancements, Tuple syntax is significantly better, and love local functions, out variables and pattern matching. Pity some of the syntax can't be more simplified (C# could do with a bit of sugar); plus still waiting on fully fledged value type structures (pure value semantics as an alternative to classes), and let's not forget type indirection, custom operators, custom subscripting, ...

https://blogs.msdn.microsoft.com/dotnet/2016/08/24/whats-new-in-csharp-7-0/

Ps. Don't forget to look at the discussion following the blog; Mads Torgersen touches on many future goals: immutable types, extension properties, nullability of reference types, non-nullable type adornments (e.g. let), ...
 
Last edited:

animal531

Expert Member
Joined
Nov 12, 2013
Messages
2,729
I saw that the other day (as well as the hacker news link). Some pretty handy QoL changes overall.
 
Top