A Clockwork Engineer

C# 7.0 New Features in One File

C# 7.0 New Features in One File

C# now has some new features with the release of Visual Studio 2017. Those features focused on code simplification, performance and data consumption. I prepared a simple console application to show them in one file.

Out variables

out variables lets us to declare variables inline. I you don’t want to declare a variable for any of out variable you can use _ sign.

Patterns “is”

Constant, Type or Var patterns can be used in if statements and you can declare new inline variables as in out variables.

Switch statements

Switch has biggest improvements. You can switch, not just primitive types, any type you want. Patterns can be used in case clauses which can have additional conditions with when keyword.


Tuples are really great but it was a backpain to use System.Tuple<...>. Now, we just add System.ValueTuple reference and it comes with tuple types to return and tuple literals to declare.

If you didn’t give any name to variables, you can reach to those variables as Item1, Item2 etc.

Local Functions

You can now declare helper functions inside a function for example recursive functions. This helps us to tidy our code.

Literal improvements

You can use digit seperator _ to make the code more readable.

Ref returns and locals

Now ref modifier return more than the value itself, the reference which shows the storage location in an array.

You can see all of the new features down below;

PS: You need to install free Visual Studio 2017 Community to use those features.

Source: New Features in C# 7.0

C# Software

Author: Olcay Bayram

A software enthusiast; currently a Senior Software Engineer of a global retail company, based in Amsterdam. Apart from the BSc, he holds a masters in IT.