Play What's New in C# 8.0
Sign in to queue


Several new language features are coming to C# in the next release, included in Visual Studio 2019. Mads Torgersen will give us a quick look at how to avoid null reference exceptions with nullable reference types, how to consume and produce asynchronous streams, and much more.

Twitter: @MadsTorgersen
Learn more about C# 8.0:





Session Type:






The Discussion

  • User profile image

    absolute *

  • User profile image
    Jan Willem Zondag

    How to set project level nullable context?

  • User profile image

    Cool thanks! :D

  • User profile image

    What is in store for

  • User profile image

    @Jan Willem Zondag

    in .csproj file:

  • User profile image

    What is "default" for non-nullable string?

    string str = default; // converting null literal or possible null value to non- / // nullable type

    This gives the same warning as replacing "default" with null;

  • User profile image

    @ArneG: Kathleen posted about VB a couple of weeks ago:

  • User profile image

    @GodwinK: Nullable reference types do not change runtime semantics of the language - all they do is add warnings. So default(string) remains null, but gets a warning.

  • User profile image

    For a kind of project i am doing i am generating a schema from functions header/prototype. Currently i have two generic classes NonNull<T> and Nullable<T>. My version of Nullable is different to C#'s.

    void MyFunc(NonNull<string> a, Nullable<string> b)


    Then i generate some schema using Reflection in run-time.

    I tried the same thing with C# 8.0 but running Console.WriteLine(typeof(string?).Name) prints String.

    Is there any solution i can know if the function argument is nullable or not ?

  • User profile image

    Can the IAsyncEnumerable already be tested in Visual Studop 2019 prview 1 with .NET Core SDK 3.0.100-preview-009812?

    While consuming seems to be no problem using yield return in an Method returning IAsyncEnumerable can't compile. With an strange error

    C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): error MSB6006: "csc.exe" wurde mit dem Code -2146232797 beendet.

  • User profile image

    LokiMidgard, this is what happens when you have German developers in your team :-))))

  • User profile image
    - nullable - one of the best improvements ever
    - asynch streams - good, but maybe not such a common use case
    - switch expressions - hmmm. The example shows that maybe you designed the solution to the problem in the wrong way. having an List<string> names would naturally solve the problem. Or maybe even better List<(int nameType, string name> names. But I have to play around to see if this will help me
    - default interface methods - good, some risk of getting back in the multi-inheritance complexity issues of C++. Have an eye on it before doing more
    - less typing where things are clear - perfect
    Overall I really appreciate the carefully executed continious improvements of the C# language, adding those features that really deliver additional value.
  • User profile image

    This is really good. I've been playing with it for a bit now; huge improvements and greatly appreciated.  

  • User profile image

    Glad to see pattern matching make it into the language, it will help a lot.

Add Your 2 Cents