Part 4. C# 7 and beyond

C# 7 is the first release since C# 1 to have multiple minor releases.[1] There have been four releases:

1

Visual Studio 2002 included C# 1.0, and Visual Studio 2003 included C# 1.2. I’ve no idea why the version number skipped 1.1, and it’s not clear what the differences were between the two versions.

  • C# 7.0 in March 2017 with Visual Studio 2017 version 15.0
  • C# 7.1 in August 2017 with Visual Studio 2017 version 15.3
  • C# 7.2 in December 2017 with Visual Studio 2017 version 15.5
  • C# 7.3 in May 2018 with Visual Studio 2017 version 15.7

Most of the minor releases have expanded on new features introduced in earlier C# 7.x releases rather than introducing entirely new areas, although the ref-related features covered in chapter 13 were greatly expanded in C# 7.2.

As far as I’m aware, no plans exist for a C# 7.4 release, although I wouldn’t completely rule it out. Having multiple versions seems to have worked reasonably well, and I expect the same sort of release cycle for C# 8.

There’s more to talk about in C# 7 than in C# 6, because the features are more complex. Tuples have an interesting separation between the types as the compiler considers them and the types that the CLR uses. Local methods fascinate me in terms of comparing their implementation with that of lambda expressions. Pattern matching is reasonably simple to understand but requires a certain amount of thought in terms of using it to its best advantage. The ref-related features are inherently complicated even when they sound simple. (I’m looking at you, in parameters.)

Although I expect most developers to find most C# 6 features useful every day, you may find some of the C# 7 features aren’t useful to you at all. I rarely use tuples in my code, because I usually target platforms where they’re not available. I don’t use the ref-related features much, as I’m not coding in a context where they’re particularly useful. This doesn’t stop them from being good features; they’re just not universally applicable. Other C# 7 features, such as pattern matching, throw expressions, and numeric literal improvements, are more likely to be useful to all developers but perhaps with less impact than the more targeted features.

I mention all of this merely to set expectations. As always, when you read about a feature, consider how you might apply it in your own code. Don’t feel forced to apply it; there are no points for using the most language features in the shortest amount of code. If you find you don’t have a use for that feature right now, that’s fine. Just remember it’s there so if you’re in a different context later, you know what’s available.

It’s also important for me to set expectations about chapter 15, which looks at the future of C#. Most of the chapter demonstrates features already available in C# 8 preview builds, but there’s no guarantee that all of those features will ship in the final build, and there may well be other features I haven’t mentioned at all. I hope you will find the features I’ve written about as exciting as I do and will keep watch for new previews and blog posts by the C# team. This is an exciting time to be a C# developer, both in terms of what we have today and the promise of a bright future.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset