Clear Method In ArrayList Class
using System;
using System.Collections;
class ClearMethod
{
static void Main()
{
ArrayList arrlist = new ArrayList();
arrlist.Add("Amit");
arrlist.Add("Mohit");
arrlist.Add(10);
foreach(object o in arrlist)
Console.Write(o + "\t");
Console.WriteLine("\n--------------------------------");
Console.WriteLine("Number of elements is " + arrlist.Count);
arrlist.Clear(); //It clear all the element of an arrylist.
Console.WriteLine("\n--------------------------------");
Console.WriteLine("Now Number of elements is " + arrlist.Count);
}
}
-------------------------------------------------------------------------------------------------------
Clear Method In ArrayList Class
Reviewed by Baljeet Singh
on
01:31
Rating:
No comments: