Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumC#nullable reference typesSingle-choice MCQ

With nullable reference types enabled, why does the compiler still warn on `string Name` in this generic class?

#nullable enable class Box<T> { public T Item = default!; public T Get() => Item; } // usage: var b = new Box<string>(); string s = b.Get(); Console.WriteLine(s.Length);