标签:reac index sys file code indexof read pre dal
使用LIST的方法FindAll.
string[] lines = System.IO.File.ReadAllLines(sfile);
List<string> rs = new List<string>(lines);
length = 25;
List<string> ss = rs;
if (length > 0)
{
ss = rs.FindAll(c => c.Length == length); //筛选出长度为25的所有项
}
foreach (string t in ks)
{
ss = ss.FindAll(c => c.IndexOf(t) >= 0); //筛选出说有包含关键词 t 的项
}
Lrs = ss;
C# 中使用对List中的每个元素进行筛选(FindAll)
标签:reac index sys file code indexof read pre dal
原文地址:http://blog.51cto.com/13567390/2061422