from the C# 7 we have available is pattern matching operator. I would like to ask if it is recommended to use is operator rather than == to check for null. Is there any difference between these two approaches?
from the C# 7 we have available is pattern matching operator. I would like to ask if it is recommended to use is operator rather than == to check for null. Is there any difference between these two approaches?
== can be customized on your type, so x == null may not be just the intended null check.
For a null check, you could do x is null, (object)x == null or object.ReferenceEquals(x, null).