Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

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);
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #item #list #loop
ADD COMMENT
Topic
Name
9+6 =