error in indexers program

Oct 3 2005 2:32 AM
// program for indexers

using System;
using System.Collections;
class List
{
    ArrayList array= new ArrayList();
    public object this[int index]
    {
        get
        {
            if (index<0 || index>=array.Count)
            {
                return null;
            }
            else
            {
                return (array [index]);
            }
        }
        set
        {
            array [ index ]=value;
        }
    }
}

class IndexerTest
{
    public static void Main()
    {
        List list= new List();
        list[0]="abc";
        list[1]="123";
        list[2]="xyz";
        for (int i=0;i<=list.Count;i++)
            Console.WriteLine(list[i]);
    }
}