3

I know that an ArrayCollection is a wrapper over an Array, but what I wanted to know is when to choose one over the other? Will the over usage of ArrayCollections result in performance?

1 Answer 1

8

The main advantage of ArrayCollection is collectionChange event which allows to get advantage of data binding with it.

Some others are:

  • Possibility to filter or sort elements of collection without modifying or copying of underlying array.
  • Implementation of ICollectionView which allows to create a cursor and iterate collection with it.
  • Display of multiple arrays in a datagrid / etc (in this case, arrays are automatically converted to arrayCollections anyway)

If you don't need any of these advantages use simple Array.

Sign up to request clarification or add additional context in comments.

3 Comments

It should also be noted that ArrayList is a more simplistic ArrayCollection and is slightly faster. It should also be mentioned that performance is an issue with Collections.
You're right @J_A_X! It hasn't latter two advantages I listed but it can be very useful!
For the third point, does that include single multi-dimensional arrays?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.