开发者

Easiest way to implement .Contains() on a ICollection<Tuple<T1,T2>>

Suppose I have a Dictionary<String, Tuple<T1,T2>>开发者_Python百科; and I want to determine if the any of the dictionary values has V1 for its T1. How would I do this most elegantly?

Linq?


Well, this comes to mind:

var exists = dict.Values.Any(t => t.Item1 == v1);


bool b = dictionary.Any(item => item.Value.Item1 == searchTerm);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜