在List< Tuple>中的Item2中搜索. [英] Search in Item2 in List<Tuple>
本文介绍了在List< Tuple>中的Item2中搜索.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在挣扎.
我怎么写这个:
I've been struggling.
How do I write this:
/* initialization */ List<Tuple<string, string, string>> mytuple = new List<Tuple<string, string, string>>();
//pseudocode
if(mytuple.Contains("hello") in Item2)
{
Console.Write("Success");
}
推荐答案
/* initialization */
List<Tuple<string, string, string>> mytuple = new List<Tuple<string, string, string>>();
bool containsHello = mytuple.Any(c=>c.Item2.Contains("hello"));
if(containsHello )
{
Console.Write("Success");
}
这篇关于在List< Tuple>中的Item2中搜索.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文