📜 ⬆️ ⬇️

Innovations C # 7

On the second day of the Build 2016 conference, Dustin Campbell and Mads Torgersen told about new constructions in the C # language.
The original presentation in English can be viewed here .



This article contains a complete overview of new language constructs, some of which are already available in Visual Studio 2015 Update 2.

1. Binary literals


Binary literals were presented for warming up.
')


You can separate zeros with an arbitrary number of underscores.



2. Local functions


Want to structure your JavaScript code? Get the opportunity to write local functions!



3. Tuples (Tuples)


Warning: available right now, but with the help of a different design ( more on MSDN )

In C # 6, you can use:
  Tuple<string,int> GiveMeATuple()
        {
            return Tuple.Create("New York", 7891957);
        }


# 7 .



( Item1, Item2).
.



4.


: Visual Studio 2015 Update 1

, Visual Studio 2015 Update 2.
.

Console.WriteLine($"Sum: {t.sum}, Count: {t.count}");


5. (Pattern matching)


.
if.



6.


. switch .
.



.



7.


? .



.


.



Source: https://habr.com/ru/post/280978/


All Articles