【发布时间】:2011-02-09 20:33:17
【问题描述】:
我有一个List<List<string>>,当我尝试使用List<string> 进行搜索时,它没有返回任何结果。
有什么想法吗?
谢谢
List<List<string>> test = new List<List<string>>();
List<string> ff = new List<string>();
ff.Add("1");
ff.Add("ABC 1");
test.Add(ff);
ff = new List<string>();
ff.Add("2");
ff.Add("ABC 2");
test.Add(ff);
var result = test.Where(x=>x.Contains("ABC"));
//result.Count(); is 0
【问题讨论】:
-
你的意思可能是
test.Where(x=>x.StartsWith("ABC"));
标签: c# .net linq generics c#-4.0