csharp best way to loop and remove
Code Example - csharp best way to loop and remove
for (int i = safePendingList.Count - 1; i >= 0; i--)
{
// some code
// safePendingList.RemoveAt(i);
}
csharp remove from list in foreach
myList.RemoveAll(x => x.SomeProp == "SomeValue");
remove item from list in for loop csharp
var data=new List<string>(){"One","Two","Three"};
for(int i=data.Count - 1; i > -1; i--)
{
if(data[i]=="One")
{
data.RemoveAt(i);
}
}