In .Net 2.5 I can usually get an equality comparison (==) between a value and its type default
if (myString == default(string))
However I g
This happens because KeyValuePair
does not define a custom == operator and is not included in the predefined list of value types that can use it.
Here is a link to the MSDN documentation for that operator.
For predefined value types, the equality operator (==) returns true if the values of its operands are equal, false otherwise.
Your best bet for an equality check in this case, because this is not a struct you have control over, is to call default(KeyValuePair
instead.