#nullable enable
using System;
class Address
{
public string? Building;
public string Street = string.Empty; // avoids that not in use warning you get..
public string City = string.Empty;
public string Region = string.Empty;
}
public class Program
public static void Main()
var address = new Address();
address.Building = null;
address.Street = null; // cannot convert null literal to null ref type.. leave empty to fix.
address.City = "London";
address.Region = null;
//to enable in a local project:
/*
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<Nullable>enable</Nullable> /// THIS ONE!!!
</ProjectGroup>
</Project>
*/