Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C# (http://www.go4expert.com/forums/c-sharp/)
-   -   Difference b/w List and ArrayList (http://www.go4expert.com/forums/difference-b-list-arraylist-t19487/)

Carlos 19Sep2009 20:54

Difference b/w List and ArrayList
 
Hi! can anyone tell me when to use List<emp> and ArrayList. Because both of them have the same capability of adding the object.

Thanks

sameer_havakajoka 19Sep2009 21:13

Re: Difference b/w List and ArrayList
 
Try Googleing it na.....I thik both are not the same buddy.

SaswatPadhi 20Sep2009 01:26

Re: Difference b/w List and ArrayList
 
The List class is the generic equivalent of ArrayList class.

You should obviously prefer List (or generics in general), as they promote type safety.
The only reason why you might like to use ArrayList might be if you want to pass it into an existing (1.x) .NET method. [[ Because .NET 1.x did not support generics. ]]

shabbir 20Sep2009 08:23

Re: Difference b/w List and ArrayList
 
Quote:

Originally Posted by sameer_havakajoka (Post 57646)
Try Googleing it na.....I thik both are not the same buddy.

Obviously both cannot be same.


All times are GMT +5.5. The time now is 12:44.