We help IT Professionals succeed at work.

Compare a List with an Array (in .NET)

183 Views
Last Modified: 2019-02-21
Compare a List with an Array (in .NET)

Please list the pros and cons of each.

Thanks
Comment
Watch Question

Developer
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Nikoloz KhelashviliSoftware Developer
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
curiouswebsterSoftware Engineer

Author

Commented:
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.
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2015
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
curiouswebsterSoftware Engineer

Author

Commented:
thanks
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.