What is default value of KeyValuePair<string, int>
?
e.g. I am running a LINQ query and returning FirstOrDefault()
value from it
KeyValuePair<string, int> mapping = (from p in lstMappings
where p.Key.Equals(dc.ColumnName, StringComparison.InvariantCultureIgnoreCase)
select p).FirstOrDefault();
if (mapping != null)
{
}
how to check if mapping
object is null/blank
(I am getting compile time error in above code Operator '!=' cannot be applied to operands of type 'System.Collections.Generic.KeyValuePair<string,int>' and '<null>'
)
PS: lstMappings
is of type
List<KeyValuePair<string, int>>