ArrayList
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
namespace ArrayList0
{
class Program
{
static void Main(string[] args)
{
ArrayList aList = new ArrayList();
aList.Add(45);
aList.Add(60);
aList.Add(78);
aList.Add(75);
aList.Add(12);
aList.Add(34);
aList.Add(89);
aList.Add(90);
aList.Add(67);
aList.Add(60);
int n = aList.Count;
Console.WriteLine();
Console.WriteLine("TotaList number of element in an array {0} ",n);
Console.WriteLine();
foreach (int b in aList)
{
Console.WriteLine(b);
}
aList.Sort();
aList.Reverse();
Console.WriteLine("Sorted in Descending order : ");
foreach (int a in aList)
{
Console.WriteLine(a);
}
Console.WriteLine();
aList.RemoveAt(9);
Console.WriteLine("Lowest marks removed : ");
foreach (int b in aList)
{
Console.WriteLine(b);
}
Console.WriteLine();
Console.WriteLine(aList.Contains(75));
aList.Clear();
Console.WriteLine("Removed aListl the List of Array");
Console.ReadKey();
}
}
}
No comments:
Post a Comment