Removing

There are two ways you can remove all the instances of an element.


Remove

The Remove method will only remove the first occurrence of an element.

myArrayList.Remove("string"); 


while (myArrayList.IndexOf("remove this") >= 0) 
{
   myArrayList.Remove("remove this");
}


RemoveAt


myArrayList.RemoveAt(1); 

Also this method does not generate an exception if the element you want to remove cannot be found.



RemoveRange




© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext