Nullable User Profile
Nullable reference annotations and null operators make absence explicit.
How it works
Safely display optional profile data.
The conditional access and coalescing operators avoid dereferencing a missing nickname.
Runnable C# example
Program.cs
using System;
record Profile(string Name, string? Nickname);
class Program
{
static void Main()
{
var profile = new Profile("Ada", null);
Console.WriteLine(profile.Nickname?.ToUpperInvariant() ?? profile.Name);
}
}
AdaPractice with the debugger
Set a breakpoint on an important assignment or condition, click Debug, and inspect the local values before stepping to the next line.