for (int i = list
{
if (list[i]
{
list
}
}
用RemoveAll效率應該可以
然後一次性刪除掉後面不符合條件的元素
如果是一條一條刪
public void RemoveItemFromList(ref List <A> list
{
List <A> tempList = new List <A>();
foreach (A a in list)
{
if (a
tempList
}
list = tempList;
}
這樣也可以
From:http://tw.wingwit.com/Article/program/net/201311/11831.html