4 ms·
Yep, looking at the IL they are equivalent. And it definitely makes code prettier due to reduced parentheses. This is also true for generics. Doing (x != null)
by eyegor 7y ago
Yep, looking at the IL they are equivalent. And it definitely makes code prettier due to reduced parentheses. This is also true for generics.
Doing (x != null), !(x is null), or (x is object) all become:
ldloc.s
ldnull
cgt.un
stloc.s