The System.Collections.ArrayList is a class in the C# language that is used to dynamically store and manipulate a collection of objects in C# arrays. This class is a part of the System.Collections namespace in the .NET Framework Class Library.
Example 1: Adding elements to the ArrayList
ArrayList fruits = new ArrayList(); // Create an empty ArrayList
fruits.Add("Apple"); // Adds an element to the ArrayList fruits.Add("Banana"); fruits.Add("Cherry");
Example 2: Removing an element from the ArrayList
fruits.Remove("Banana"); // Removes the "Banana" element from the ArrayList
Example 3: Iterating through the ArrayList
foreach (string fruit in fruits) { Console.WriteLine(fruit); // Outputs each element in the ArrayList }
The package library for the System.Collections.ArrayList is the .NET Framework Class Library.
C# (CSharp) System.Collections.ArrayList - 43 examples found. These are the top rated real world C# (CSharp) examples of System.Collections.ArrayList extracted from open source projects. You can rate examples to help us improve the quality of examples.