나는 고생했습니다.
나는이 쓰기 어떻게 :목록의 항목 2에서 검색하기 <Tuple>
/* initialization */ List<Tuple<string, string, string>> mytuple = new List<Tuple<string, string, string>>();
//pseudocode
if(mytuple.Contains("hello") in Item2)
{
Console.Write("Success");
}
나는 고생했습니다.
나는이 쓰기 어떻게 :목록의 항목 2에서 검색하기 <Tuple>
/* 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");
}
당신은 그것을 확인하기 위해 LINQ를 사용할 수 있습니다
List<Tuple<string, string, string>> mytuple = new List<Tuple<string, string, string>>();
if(mytuple.Where(t=>t.Item2.Contains("hello")).Any())
Console.Write("Success");
내 대답은 더 빠릅니다. :) 당신은 당신의 물건에 인사가 들어있는 모든 항목을 가져다가 모든 항목이 있는지 확인합니다. 내게 일치하는 것을 찾으면 내 것이 멈출 것이다. –
이 쿼리는 절대적으로 동등합니다. 두 사람은 처음에 –
오른쪽 남자와 일치합니다 : 이것은 linq의 인텔리전스 때문입니다. –
나는 당신이 무엇에 관해 얘기하는지 모른다. –
질문을하기 전에 [faq]와 [ask]를 읽으십시오. –