Answers for "c# loop and remove item"

C#
0

remove item from list in for loop c#

var data=new List<string>(){"One","Two","Three"};
for(int i=data.Count - 1; i > -1; i--)
{
    if(data[i]=="One")
    {
        data.RemoveAt(i);
    }
}
Posted by: Guest on October-01-2021
0

c# best way to loop and remove

for (int i = safePendingList.Count - 1; i >= 0; i--)
{
    // some code
    // safePendingList.RemoveAt(i);
}
Posted by: Guest on October-19-2020

Code answers related to "c# loop and remove item"

C# Answers by Framework

Browse Popular Code Answers by Language