Clone an ArrayList : ArrayList : Collections Data Structure C# Source Code


Custom Search

C# Source Code » Collections Data Structure » ArrayList »

 

Clone an ArrayList








    



using System;
using System.Collections;

public class Starter {
    public static void Main(string[] argv) {

        ArrayList al1 = new ArrayList();
        foreach (string arg in argv) {
            al1.Add(int.Parse(arg));
        }
        al1.Sort();
        ArrayList al2 = (ArrayList)al1.Clone();
        for (int count = 0; count < al2.Count; ++count) {
            al2[count] = ((int)al2[count]) * 2;
        }
        foreach (int number in al2) {
            Console.WriteLine(number);

        }
    }
}


           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Collections Data Structure
» ArrayList