Check if KeyValuePair exists with LINQ's FirstOrDefault

后端 未结 6 1108
情书的邮戳
情书的邮戳 2021-02-03 17:03

I have a dictionary of type

Dictionary

I want to return the first instance where a condition is met using

var         


        
6条回答
  •  既然无缘
    2021-02-03 17:18

    Use the default() keyword.

    bool exists = !available.Equals(default(KeyValuePair));
    

提交回复
热议问题