Contact: aviboots(AT)netvision.net.il
40,026 questions
51,982 answers
573 users
using System; using System.Collections; class Program { static void Main() { ArrayList al = new ArrayList(); al.Add("c#"); al.Add("c"); al.Add("java"); al.Add("php"); al.Add("python"); foreach (object item in al) { Console.WriteLine(item); } } } /* run: c# c java php python */
using System; using System.Collections; class Program { static void Main() { ArrayList al = new ArrayList(); al.Add("c#"); al.Add("c"); al.Add("java"); al.Add("php"); al.Add("python"); foreach (object item in al) { Console.WriteLine(item); } Console.WriteLine("\n"); al.Insert(0, "c++"); al.Insert(3, "vb.net"); foreach (object item in al) { Console.WriteLine(item); } } } /* run: c# c java php python c++ c# c vb.net java php python */
using System; using System.Collections; class Program { static void Main() { ArrayList al = new ArrayList(); al.Add("c#"); al.Add("c"); al.Add("java"); al.Add("php"); al.Add("python"); foreach (object item in al) { Console.WriteLine(item); } Console.WriteLine("\n"); al.Remove("java"); foreach (object item in al) { Console.WriteLine(item); } } } /* run: c# c java php python c# c php python */
using System; using System.Collections; class Program { static void Main() { ArrayList al = new ArrayList(); al.Add("c#"); al.Add("c"); al.Add("java"); al.Add("php"); al.Add("python"); foreach (object item in al) { Console.WriteLine(item); } Console.WriteLine("\n"); al.RemoveAt(2); foreach (object item in al) { Console.WriteLine(item); } } } /* run: c# c java php python c# c php python */
using System; using System.Collections; class Program { static void Main() { ArrayList al = new ArrayList(); al.Add("c#"); al.Add("c"); al.Add("java"); al.Add("php"); al.Add("python"); foreach (object item in al) { Console.WriteLine(item); } Console.WriteLine("\n"); al.RemoveRange(1, 3); foreach (object item in al) { Console.WriteLine(item); } } } /* run: c# c java php python c# python */
using System; using System.Collections; class Program { static void Main() { ArrayList al = new ArrayList(); al.Add("c#"); al.Add("c"); al.Add("php"); al.Add("java"); al.Add("python"); foreach (object item in al) { Console.WriteLine(item); } Console.WriteLine("\n"); al.Sort(); foreach (object item in al) { Console.WriteLine(item); } } } /* run: c# c php java python c c# java php python */
using System; using System.Collections; class Program { static void Main() { ArrayList al = new ArrayList{"c#", "c", "php", "java", "python", "vb.net"}; Console.WriteLine(al.Count); } } /* run: 6 */