Search Unity

C# 7

Discussion in '2017.1 Beta' started by makeshiftwings, Apr 28, 2017.

Thread Status:
Not open for further replies.
  1. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,311
    I noticed the new .NET 4.6 mode only supports C# 6 by default. Is there any way to enable C# 7 support?
     
    Xepherys likes this.
  2. WendelinReich

    WendelinReich

    Joined:
    Dec 22, 2011
    Posts:
    217
    Bumb that, C# 7 rocks.

    Note however that you can already use most of the C# 7 features if you compile your code into a library inside VS 2017. Out variables, pattern matching, local functions all work out of the box. I haven't tested tuples but they should work (as noted here) if you import the System.ValueTuple package.
     
    x0r and Qbit86 like this.
  3. thomak-dev

    thomak-dev

    Joined:
    Mar 8, 2015
    Posts:
    15
    I'd like to use C#7 in Unity too. Return by ref is a really nice language feature for optimization. At this rate we are just going to get another outdated C# version as the new default
     
    Xepherys and Qbit86 like this.
  4. stefan_furcht

    stefan_furcht

    Joined:
    Feb 10, 2017
    Posts:
    7
    Seconded, C# 7 is better than 4,5 & 6 together.
     
  5. Alex-Lian

    Alex-Lian

    Guest

    Mono only recently introduced c# 7 support, so time is needed to let it stabilize then integrate, test and move things forward. Now that we're working more closely with the .Net Foundation, expect things to move faster - however this topic is not pertinent to this beta.
     
    Ryiah, WendelinReich and elbows like this.
  6. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,420
    Sounds cool to me, confirms what I thought that the long period where the mono/.NET side of things was in a sort of limbo (apart from IL2CPP) was due to factors that are now gone and so is now well behind us :)
     
  7. PedroGV

    PedroGV

    Joined:
    Nov 1, 2010
    Posts:
    410
    ETA for c# 7 (after Unity 2017 gets released)?
     
  8. Alex-Lian

    Alex-Lian

    Guest

    No ETA other than we'll be working on it and getting it stable from our side.
     
    6Jarv9 and Flurgle like this.
Thread Status:
Not open for further replies.
unityunity