Link to home
Start Free TrialLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

Compare a List with an Array (in .NET)

Compare a List with an Array (in .NET)

Please list the pros and cons of each.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of it_saige
it_saige
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of curiouswebster

ASKER

I thought that an ArrayList automatically up-typed anything you add to it to type Object, and used boxing and unboxing to do so. This means the compiler does not enforce the type you pass in, like a generic list List<> does for you at compile time.

Secondly, an Array (versus an ArrayList) seems even more un-disciplined. It seems you can pile in data of any type, and even more arrays. It then is the job of the programmer to query that array before addressing a cell directly.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks