using System; using System.Collections; class Program { static void Main() { // // Create an ArrayList with two values. // ArrayList list = new ArrayList(); list.Add(3); list.Add(4); // // Second ArrayList. // ArrayList list2 = new ArrayList(); list2.Add(5); list2.Add(6); // // Add second ArrayList to first. // list.AddRange(list2); // // Display the values. // foreach (int i in list) { Console.WriteLine(i); } } } Output 3 4 5 6
using System; using System.Collections; class Program { static void Main() { // // Create an ArrayList with 4 strings. // ArrayList list = new ArrayList(); list.Add("DotNet"); list.Add("Java"); list.Add("PHP"); list.Add("SQL"); // // Get last two elements in ArrayList. // ArrayList range = list.GetRange(2, 2); // // Display the elements. // foreach (string val in range) { Console.WriteLine(val); } } } OutPut: PHP SQL
Regards, Sunil
Nitha Deepak
Regards, Susan
Thanks&Regards LakshmiNarayana Nalluri.
Login to post response