Lying to the compiler

added by DotNetKicks
5/28/2019 1:10:36 PM

2 Kicks, 373 Views

This morning I tweeted this: Just found a C# 8 nullable reference types warning in Noda Time. Fixing it by changing Foo(x, x?.Bar) to Foo(x, x?.Bar!) which looks really dodgy... anyone want to guess why it's okay? This attracted more interest than I expected, so I thought I'd blog about it.