What is C# arraylist?

(1) Answers | Write your answer


In C#, ArrayList is a class collection that can be used to store values of the same type. When a value which is not an object is added to the ArrayList object, it is converted (boxing) to object type and it is converted back (unboxing)when it is read.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ConsoleApplication1

class Program

static void Main(string[] args)




public static void Alist()
System.Collections.ArrayList alist = new System.Collections.ArrayList(); //create ArrayList object
int i;
for (i = 0; i < 10; i++) alist.Add(i); //add integers to collection
foreach(int x in alist ) Console .WriteLine (x); //read them from the collecttion