How can an object not be compared to null?
Posted
by ProfK
on Stack Overflow
See other posts from Stack Overflow
or by ProfK
Published on 2009-03-15T16:48:45Z
Indexed on
2010/04/12
3:23 UTC
Read the original article
Hit count: 221
I have an 'optional' parameter on a method that is a KeyValuePair. I wanted an overload that passes null to the core method for this parameter, but in the core method, when I want to check if the KeyValuePair is null, I get the following error:
Operator '!=' cannot be applied to operands of type System.Collections.Generic.KeyValuePair<string,object>' and '<null>.
How can I not be allowed to check if an object is null?
© Stack Overflow or respective owner