8 Replies
you could also use
if (maybe.HasValue) {}
which do you prefer?
i use all three tbh
but mostly
is int
and .HasValue
nowadays i believewhat about
is not null
really i use
is not <type>
ratherThere is one small reason for
is
over ==
and that is, that ==
could technically be overwritten. While is
cannot.And also
is {}
, before is not null
is a thing
Actually I use ??
mostly, not explicitly checking for nullis {}
over is not null
lets you cast to a variable too
x is {} y
works, x is not null y
does not