What is the difference between array and arraylist in c#?


Arrays are strongly typed collection of same datatype and these arrays are fixed length that cannot be changed during runtime. Generally in arrays we will store values with index basis that will start with zero. If we want to access values from arrays we need to pass index values.

string[] arr=new string[2];

arr[0] = “welcome”;

arr[1] = “pramadha”;


Array lists are not strongly type collection. It will store values of different datatypes or same datatype. Array list size will increase or decrease dynamically it can take any size of values from any data type. These Array lists will be accessible with “System.Collections” namespace

ArrayList strarr = new ArrayList();

strarr.Add(“welcome”); // Add string values

strarr.Add(10);   // Add integer values

strarr.Add(10.05); // Add float values



These are strong type collection and allow to store fixed length

Array Lists are not strong type collection and size will increase or decrease dynamically

In arrays we can store only one datatype either int, string, char etc…

In arraylist we can store all the datatype values

Arrays belong to System.Array namespace

Arraylist belongs to System.Collection namespaces


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s