KeyValuePair<string, int>的默认值是多少
例如,我正在运行一个LINQ查询,并从中返回FirstOrDefault()值
KeyValuePair<string, int> mapping = (from p in lstMappings
where p.Key.Equals(dc.ColumnName, StringComparison.InvariantCultureIgnoreCase)
select p).FirstOrDefault();
if (mapping != null)
{
}如何检查mapping对象是否为空/空
(我在上面的代码Operator '!=' cannot be applied to operands of type 'System.Collections.Generic.KeyValuePair<string,int>' and '<null>'中遇到了编译时错误)
PS:lstMappings的类型
List<KeyValuePair<string, int>>https://stackoverflow.com/questions/21404249
复制相似问题