New Features in C# 7.0

Sign in to queue

Description

A quick overview of some of the new language features coming to C# 7.0.

For more details see our blog post.

For more information, check out this course on Microsoft Virtual Academy:

Day:

0

Session Type:

On-demand

Code:

105

Embed

Download

Download this episode

For more information, check out this course on Microsoft Virtual Academy:

The Discussion

  • User profile image
    Juanpa

    Magnificent, I realized that I have to add the System.ValueTuple nuget reference, any other in any case?. Is there any issue deploying to the store with all the new stuff? Hope not.

  • User profile image
    Jon

    Why would Item start at 1 and not 0?

  • User profile image
    Onurg

    Good, but looks like baby steps towards being a more functional language. I still can't understand what good are these features without things like records or algebraic data types. I guess time will tell.

  • User profile image
    Andrew Hanlon

    Unless this has changed in the release version (I hope it hasn't) than it seems there is a mistake within pattern matching example where the variable 'i' is used outside its if level scope. The roslyn pattern matching spec says:

    The scope of a pattern variable is as follows:

    - If the pattern appears in the condition of an if statement, its scope is the condition and controlled statement of the if statement, but not its else clause.

    If this is correct than the i variable should not be in scope after the if.

  • User profile image
    Josh

    Looks good.

  • User profile image
    Yossu

    Looking more like F# every release! That's a good thing by the way, it means we're getting some of the goodness that F# devs had had for a while.

  • User profile image
    Guy Cox

    How about an overrideable assigment operator.. That would go a long way to insuring dimensional integrity of computations involving physical quantities -- acceleration = velocity / time.. where each dimension is represented by a value on the measurement vector length, time, mass, charge

  • User profile image
    gigyjoseph
  • User profile image
    dumky

    @Jon: Item starts at 1 rather than 0 because of the legacy of System.Tuple types. System.ValueTuple is a very similar set of types, with the difference that they are structs.
    That said, in C# tuples, elements can be named, so I don't expect to see that people use Item1, Item2, etc frequently.


    For example:

    (string first, string last) person = GetAccount();

    Console.WriteLine("{person.first} {person.last}");

  • User profile image
    Laying in My Bed Abas

    com(alto-,col-,con-,or cor-,)

  • User profile image
    gduncan411

    @gigyjoseph:Fixed. Thanks for the heads up

  • User profile image
    Yonny

    Nice!!

    (I don't know F#, but I know Python and these features make C# closer to Python than before. Good stuff)

  • User profile image
    Kaelum

    @Andrew Hanlon:

    Mads made a major change to scoping rules, stating that it was being asked for by everyone (no names given), and said that it's a done deal, no discussion.  You can read about it here:

    https://github.com/dotnet/roslyn/issues/12939

    Moving forward, it will be impossible to know what variables are in scope.

  • User profile image
    Vivek​Ragunathan

    Hi Mads, When are we going to get read-only (const) variables like C++ const or java final. Read-only variables is an important step towards functional programming (grass root level). It would also be good if C# supports const methods like C++ to create immutable types. What do you think?

  • User profile image
    SWest

    Yeah, now is Erlang, you only miss receive -> and send !

  • User profile image
    lindexi

    What is the C# 7 release date?

  • User profile image
    Veera Pallati

    Great Features !!!.

Add Your 2 Cents