2
Answers

ArrayList

Maha

Maha

11y
919
1
Console.WriteLine(alDemo.Add("Four")); is giving number of alDemo.Add() count. Please explain the reason. Problem is highlighted.

using System;
using System.Collections;

class ArrayListProgram
{
static void Main(string[] args)
{
ArrayList alDemo = new ArrayList();

alDemo.Add("One");
alDemo.Add("Two");
alDemo.Add("Three");
alDemo.Add(1);
alDemo.Add(true);
alDemo.Add(10.01);

Console.WriteLine(alDemo.Add("Four"));

alDemo.Add("Five");
alDemo.Add("Six");

alDemo.Insert(3, "Seven");

alDemo.RemoveAt(2);

alDemo.Remove("Five");

//alDemo.Sort();
//alDemo.Reverse();

foreach (Object item in alDemo)
{
Console.WriteLine(item);
}

Console.Read();
}
}

Answers (2)