全部博文(1293)
分类: C#/.net
2016-01-11 18:31:00
static void Main(string[] args)
{
List dataList = new List();
for (int i=0;i<5;i++)
{
dataList.Add("string" + i);
}
string result = dataList.Find(destStr => destStr == "string10");
int index = dataList.FindIndex(0, dataList.Count, destStr => destStr == "string10");
int index2 = dataList.FindIndex(0, dataList.Count, destStr => destStr == "string3");
if(index2 != -1)
dataList.RemoveAt(index2);
Console.ReadLine();
}
参考:
http://www.cnblogs.com/zhangchenliang/archive/2012/08/15/2640396.html