Introduction : This tutorial explain how to remove value from ArrayList in Asp.Net.This this section well will see how to remove object from ArrayList. To know more about array list please refer this tutorial. Arraylist is available under System.Collections Namespace
http://www.dotnetspark.com/tutorial/10-27-arraylist.aspx
Let's create the arraylist first ArrayList MyArrayList = new ArrayList();//add some value MyArrayList.Add("First"); MyArrayList.Add("Second"); MyArrayList.Add("Third"); MyArrayList.Add("Fourth");
Now ArrayList class object provide 3 methods to remove the value from ArrayList there are:
-
Remove()
-
RemoveAt()
-
RemoveRange()
See the example of all the above method MyArrayList.Remove("Hello"); MyArrayList.RemoveAt(1); //will remove the value at index 1 MyArrayList.RemoveRange(1, 3); //will remove the object from index 1 to 3
|