?

Log in

Previous Entry | Next Entry

.NET interview questions: - What is the difference between arraylist and list? Are Arraylist faster or Arrays?

Difference between arraylist and list: -

  • Arrays are fixed in size while Arraylist is resizable.

  • Arrays are strongly typed, in other words when you create an array it can store only one data type data. Arraylist can store any datatype.

Are Arraylist faster or Arrays: -

Array list takes any data type which leads to boxing and unboxing. As arrays are strongly typed they do not do boxing and unboxing. So arrays are faster as compared to array list.

// Array definition
int[] str = new int[10];

// Array list definition
ArrayList MyList = new ArrayList();


Generic equivalent for array list, stack, queues and hashtable: -

Below are the listed generic equivalents for each of them:-

  • Array list generic equivalent is List<int>.

  • Stack generic equivalent is Stack<int>.

  • Queue generic equivalent is Queue<int>.

  • Hashtable generic equivalent is Dictionary<int,int>.

Also see .NET interview questions video on different types of collection in .NET and C#: -

Copy right www.questpond.com

Buy 600+ Real Time Interview Videos

Call +91-22-66752917 or mail us on questpond@questpond.com for more details on C#, .NET, ASP.NET, SQL Server interview question videos.

SQL Server interview question videos

Latest Month

January 2017
S M T W T F S
1234567
891011121314
15161718192021
22232425262728
293031    

Tags

Powered by LiveJournal.com