class Program
{
static void Main(string[] args)
{
ArrayList names = new ArrayList();
names.Add("Mithilesh");
names.Add("Dhanajee");
names.Add("Rakesh");
names.Add("DaveDas");
names.Add("Amod");
foreach (string name in names)
{
Console.WriteLine(name);
}
Console.WriteLine();
Console.ReadLine();
ArrayList objName = new ArrayList();
objName.Add("Mohan");
objName.Add("Sohan");
objName.Add("Ram");
objName.Add("Sonu");
objName.AddRange(names);
foreach (string name in objName)
{
Console.WriteLine(name);
}
DeleteSingle(objName);
objName.RemoveRange(3, 3);
Console.WriteLine("After Deleting
the Range");
foreach (string name in objName)
{
Console.WriteLine(name);
}
Console.ReadLine();
}
public static void
DeleteSingle(ArrayList list)
{
Console.WriteLine("Enter the Name
which you want to delte");
string str1 = Console.ReadLine();
list.Remove(str1);
Console.WriteLine();
foreach (string name in list)
{
Console.WriteLine(name);
}
Console.ReadLine();
}
}
Output:
No comments:
Post a Comment