How to Merge two ArrayList Collections in .NET


If you have two ArrayList collections and you want to merge items available in both collections, you can use AddRange method of ArrayList class

ArrayList list1 = new ArrayList(); 
ArrayList list2 = new ArrayList(); 

list1.Add("HTML"); 
list1.Add("XML"); 

list2.Add("CSS"); 
list2.Add("PHP"); 

list1.AddRange(list2);

 

 

About author


User avatar

Waqas Anwar

Founder of EzzyLearning.com, Senior Consultant, Microsoft .NET and Web Technologies

Add Comment