Possible Duplicate:
“new” keyword in property declaration
Pardon me if this is C# 101, but I am trying to understand the code below:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace Generics
{
class RabbitCollection : ArrayList
{
public int Add(Rabbit newRabbit)
{
return base.Add(newRabbit);
}
//collections indexer
public new Rabbit this[int index]
{
get { return base[index] as Rabbit; }
set { base[index] = value; }
}
}
}
Why does the indexer have new
in front of it? By the way, Rabbit is a class defined in another file. Thanks!