Array vs Collection

Question posted in Computer Software on 05 2011
Rate question difficulty level 0 Votes
What are the differences between an array and a collection?
when will you use it ?
 
 
11 Answers
 
An array is a data structure that contains several variables of the same type.
An array has the following properties:

Single-Dimensional, Multidimensional or Jagged.

A jagged array is an array of arrays, and therefore its elements are reference types and are initialized to null.

Arrays are zero indexed: an array with n elements is indexed from 0 to n-1.

Array types are reference types derived from the abstract base type Array. Since this type implements IEnumerable and IEnumerable, you can use foreach iteration on all arrays in C#.

From: http://msdn.microsoft.com/en-us/library/9b9dty7d.aspx

A collection is simply an object that groups multiple elements into a single unit. Collections are used to store, retrieve, manipulate, and communicate aggregate data.

Versions of collections include list, binary-trees, hashtables.

The difference is that arrays are list of variables of the same type. Collections can contain objects or data of any type.

ref: http://en.wikipedia.org/wiki/Collection_(computing)

11/16/2011
 
 
Your's is the intelligent aprpaoch to this issue.

01/01/2012
 
 
 
 
Collections are dynamic in that they grow or shrink as you add and remove items from them.
Arrays tend to fixed in size, i.e. they can only contain a certain number of values. When you want to resize them then you need to recreate them which is normally done with the Redim statement but some languages don't allow arrays to be resized. Arrays are static in that they don't grow or shrink as you add/remove items from them.

Both allow sorting and you can get the number of elements in each very easily.Arrays use less memory and tend to perform faster(not always) Colelctions are great to work with, so easy.






02/27/2012
 
 
 
 
Do you go through endless amounts of foundation brands, trying to find one that suits and gives you a flawless coverage? Stop.
If you want flawless looking skin, airbrush makeup is definitely the way forward.

04/19/2012
 
 
 
 
 
 
 
 
 
 
This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post.
www.waschmaschinenimtest.net

05/03/2012
 
 
Add an answer*
 
Your name
Email
 
Company: 5minmedia
Location: Israel
collection array .net

add a question

arrow_blue


Now hiring!
---------------------------
---------------------------
---------------------------
---------------------------
---------------------------
---------------------------
---------------------------