remove-items-from-arraylist

Just as we add items to an ArrayList, we can remove items from an ArrayList. We use the Remove, RemoveAt and RemoveRange methods to remove items from an ArrayList.

Remove Method The Remove method is used to remove an item from the ArrayList. If we remove an item that doesnot exist in the ArrayList, this method will not throw any error.



RemoveAt Method To remove an item from a specific location from the ArrayList, we use RemoveAt method. In the following code example, the 4th item from the ArrayList is removed.

arrayList.Remove("Customer10"); 
arrayList.RemoveAt(4);


We send an object to be removed from the collection to the Remove method as a parameter and whereas to the RemoveAt method we send a particular index to remove an object.