1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Difference b/w List and ArrayList

Discussion in 'C#' started by Carlos, Sep 19, 2009.

  1. Carlos

    Carlos New Member

    Joined:
    Dec 5, 2008
    Messages:
    57
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    none
    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
     
  2. sameer_havakajoka

    sameer_havakajoka New Member

    Joined:
    Sep 14, 2009
    Messages:
    271
    Likes Received:
    2
    Trophy Points:
    0
    Occupation:
    Sleeping
    Location:
    Hava Ke Paro Me
    Try Googleing it na.....I thik both are not the same buddy.
     
  3. SaswatPadhi

    SaswatPadhi ~ Б0ЯИ Τ0 С0δЭ ~

    Joined:
    May 5, 2009
    Messages:
    1,343
    Likes Received:
    55
    Trophy Points:
    0
    Occupation:
    STUDENT !
    Location:
    Orissa, INDIA
    Home Page:
    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. ]]
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
    Obviously both cannot be same.
     

Share This Page