ArrayList.Remove : ArrayList « System.Collections « C# / C Sharp by API






ArrayList.Remove

 


using System;
using System.Collections;

class MainClass
{
  public static void Main()
  {
    ArrayList myArrayList = new ArrayList();
    myArrayList.Add("A");
    myArrayList.Add("A");
    myArrayList.Add("A");
    myArrayList.Add("A");
    myArrayList.Add("A");
    myArrayList.Add("A");
    myArrayList.Add("A");
    myArrayList.Add("A");
    myArrayList.Add("A");
    myArrayList.Add("A");
    

    string[] anotherStringArray = {"Here's", "some", "more", "text"};
    myArrayList.SetRange(0, anotherStringArray);


    myArrayList.RemoveAt(0);
    myArrayList.Remove("text");
    myArrayList.RemoveRange(3, 2);
    DisplayArrayList("myArrayList", myArrayList);

  }
  public static void DisplayArrayList(string arrayListName, ArrayList myArrayList)
  {
    for (int i = 0; i < myArrayList.Count; i++){
      Console.WriteLine(arrayListName + "[" + i + "] = " +
        myArrayList[i]);
    }
  }

}

   
  








Related examples in the same category

1.new ArrayList()
2.new ArrayList(Collection c)
3.ArrayList.Add
4.ArrayList.AddRange
5.ArrayList.BinarySearch
6.ArrayList.Capacity
7.ArrayList.Clear()
8.ArrayList.Clone
9.ArrayList.Contains
10.ArrayList.CopyTo
11.ArrayList.GetEnumerator()
12.ArrayList.GetRange
13.ArrayList.IndexOf
14.ArrayList.Insert
15.ArrayList.InsertRange()
16.ArrayList.IsFixedSize
17.ArrayList.IsReadOnly
18.ArrayList.LastIndexOf
19.ArrayList.RemoveAt
20.ArrayList.RemoveRange
21.ArrayList.Reverse()
22.ArrayList.SetRange
23.ArrayList.Sort()
24.ArrayList.Synchronized
25.ArrayList.ToArray
26.ArrayList.ToArray(typeof(T))
27.ArrayList.TrimToSize()