I want to check if a reference type is null. I see two options (_settings is of reference type FooType):
if (_settings == default(FooType)) { ... }
and
if (_settings == null) { ... }
How do these two perform differently?
There's no difference. The default value of any reference type is null
.
MSDN's C# reference page for default
keyword: https://msdn.microsoft.com/en-us/library/25tdedf5.aspx.