No More Solutions

You can find a lot of debugging and deploying problems while developing applications in .NET and Visual Basic here. There are also some querying tips in SQL and typical source codes which might be useful shared here.

Appending ArrayList to another ArrayList

A friend of mine asked about how to append an ArrayList to another ArrayList in C#. I found out that it's an easy task as long as the type of the ArrayList is the same. Just have to typecast it to ICollection.

ArrayList a = new ArrayList();
a.Add("Array 1");
a.Add("Array 2");

ArrayList b = new ArrayList();
b.Add("Array 3");
b.Add("Array 4");

Bookmark and Share


  1. AIKA GALLECA said...

    we do have this in our programming also
    this is one of the basic ways to learn hardcore programming.

  2. Steven Luck said...

    Hahaha, u do? I didn't, I only had the simple one, typecasting in primitive data type, in classes. hehehe...

  3. CookAtRice said...

    thx your code.

    I have more guess...
    How to access and change arrayList's value of arrayList?

    ArrayList a = new ArrayList();
    ArrayList b = new ArrayList();

    a.Add(b); //right?

    I wanna chang "apple" -> "kiwi"

    How I do?

  4. Steven Luck said...

    I don't think it's possible to change the value of an object in an ArrayList without re-adding it. You have to loop through the items and change it manually.

Post a Comment