Tuesday 17 January 2012

differences between arrays and collections

Explain the similarities and differences between arrays and collections?


• The Array class is not part of the System.Collections namespace. But an array is a collection, as it is based on the list interface.

• Array has a fixed capacity but the classes in the System.Collections namespace don’t have fixed capacity. That’s why array is a static container, but collection is dynamic container.

• Collections objects have a key associated with them. You can directly access an item in the collection by the key. But to find a specific item in an array, unless you don’t know the index number you need to traverse the array to find the value.

No comments:

Post a Comment