Insert And Remove And RemoveAtMethod In ArrayList Class
using System;
using System.Collections;
class InsertAndRemoveAndRemoveAtMethod
{
static void Main()
{
ArrayList arrlist = new ArrayList();
arrlist.Add("Amit");
arrlist.Add("Mohit");
arrlist.Add(10);
arrlist.Add("Amit");
foreach(object o in arrlist)
Console.Write(o + "\t");
Console.WriteLine("\n--------------------------------");
arrlist.Insert(2,"Gopal");
foreach(object o in arrlist)
Console.Write(o + "\t");
Console.WriteLine("\n--------------------------------");
arrlist.Remove("Amit");
foreach(object o in arrlist)
Console.Write(o + "\t");
Console.WriteLine("\n--------------------------------");
arrlist.RemoveAt(1);
foreach(object o in arrlist)
Console.Write(o + "\t");
}
}
--------------------------------------------------------------------------------------------------------
Insert And Remove And RemoveAtMethod In ArrayList Class
Reviewed by Baljeet Singh
on
03:19
Rating:
No comments: