Skip to content

C# 8.0 nullable references #4036

@snakefoot

Description

@snakefoot

Nullable references makes use of method-attributes to signal if references should have been null-checked first before calling.

<PropertyGroup>
    <LangVersion>8.0</LangVersion>
    <Nullable>enable</Nullable>
</PropertyGroup>

The "funny" part is that LangVersion=8.0 is only fully supported for NetCoreApp3. And if targeting NetCoreApp3 then it is enabled by default.

But these features also works out of the box on older platforms:

  • Async enumerables
  • Index and Range support
  • Default Implementations
  • Nullable Annotations in first-party libraries.

But if you try to use other language features of C# 8.0 while targeting .NET Standard 2.0, all bets are off!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions