aspdotnet-suresh offers articles and tutorials,csharp dot net, articles and tutorials,VB.NET Articles,Gridview articles,code examples of 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

C# - Difference between Array and Arraylist in C# with Example

Sep 17, 2013

Here I will explain difference between array and arraylist in with example.  



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.

Declaration of Arrays

Generally we will declare arrays with fixed length and store values like as shown below

string[] arr=new string[2];
arr[0] = "welcome";
arr[1] = "Aspdotnet-suresh";
In above code I declared array size 2 that means we can store only 2 string values in array.


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

Declaration of Arraylist

To know how to declare and store values in array lists check below code

ArrayList strarr = new ArrayList();
strarr.Add("welcome"); // Add string values
strarr.Add(10);   // Add integer values
strarr.Add(10.05); // Add float values
If you observe above code I haven’t mentioned any size in array list we can add all the required data there is no size limit and we will use add method to bind values to array list

Difference between Array and ArrayList

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

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest,, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email


PremNath RajaSekaran said...

Very Useful !

Anonymous said...

Any noticeable performance difference? Obviously array is going to be faster but is it to a point that you should avoid ArrayList as often as you can?

Shri said...

thnx dude... these are the fadduuu definations...

Rajesh Pathakoti said...

Simple and very clear article. Thank you very much anna.

Anonymous said...

understanding very easily,great job

Raju Kuppusamy said...

Gud Article brother thx

hiren kanetiya said...

nice sanpshot.....for increasing the kownlaged about array & array list ......

Revathy said...

Hi Suresh,

Very very ....useful to me :) keep rocking ......

Anonymous said...


Chinna Selvamca said...

very super brother great work................................thanks

gsdg said...


Dhiraj Kumar said...
This comment has been removed by the author.
Anonymous said...

Nice article.......

satish ch said...

Very good info bro with simple example now i got the knowledge about arraylist thanks bro for posting this use full info

Mallikarjun S said...

nice article suresh.can u explain the jagged array?

Mallikarjun S said...

Nice Article can you explain the jagged Array concept?


Very NIce

Atul Chirame said...

In difference section,

In arrays we can store only one datatype either int, string, char etc…
In arraylist we can store all the datatype values

This is wrong difference. We can create array of any datatype.
Home[] arr = { new Home(),new Home(),new Home()};

Nagi Reddy said...

why can't store the different types in array collection with object type.

object[] arr= new object[3]

with tis we can store different data types

Irfan Kumte said...

Thank u...explained simply and meticulously.

Anonymous said...

very usefull

Give your Valuable Comments

Other Related Posts

© 2015 All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.