【发布时间】:2009-03-15 16:48:45
【问题描述】:
我在 KeyValuePair 方法上有一个“可选”参数。我想要一个将 null 传递给该参数的核心方法的重载,但是在核心方法中,当我想检查 KeyValuePair 是否为 null 时,出现以下错误:
Operator '!=' cannot be applied to operands of type System.Collections.Generic.KeyValuePair<string,object>' and '<null>.
如何不允许我检查一个对象是否为空?
【问题讨论】:
-
你能给出一个显示这个错误的代码示例吗?