Nullable reference types in C#

Csharp

Turning the feature on makes the compiler point at every place a null could slip through.

#nullable enable

public string Describe(User? user) =>
    user?.Name ?? "anonymous";

// In the .csproj, for the whole project:
// <Nullable>enable</Nullable>

More in Systems

Random picks