ICollection Constructor in ArrayList
In this article I will explain the ArrayList Constructor (ICollection).
Introduction
The ArrayList Constructor (ICollection) initializes a new instance of the ArrayList class that contains elements copied from the specified collection and that has the same initial capacity as the number of elements copied.
Example
namespace ConsoleApplication6
{
class Program
{
static void Main(string[] args)
{
// Creates a new ArrayList.
ArrayList days = new ArrayList();
days.Add("Sunday");
days.Add("Monday");
days.Add("Tuesday");
days.Add("Wednesday");
ArrayList days1 = new ArrayList(days);
foreach (string s in days1)
{
Console.WriteLine(s);
}
}
}
}
|
Output
Ask Your Question
Got a programming related question? You may want to post your question here