Home
Manage Your Code
Snippet: Remove an item from an ArrayList (C#)
Title: Remove an item from an ArrayList Language: C#
Description: If you want to remove an array item, this routine will do it for you. Views: 1687
Author: Eric Liew Date Added: 9/22/2008
Copy Code  
1int count = myArrayList.Count;
2for(int i=0; i<count;)
3{
4        myArrayListItem item = (myArrayListItem)myArrayList[i];
5        if (myArrayListItem.MyPropery > someValue)
6        {
7                myArrayList.RemoveAt(i);
8                count--;
9        } else {
10                i++;
11        }
12
13}