If you mean the array indexer,, You overload that just by writing an indexer property.. And you can overload, (write as many as you want) indexer properties as long as each one has a different parameter signature
public class EmployeeCollection: List<Employee>
{
public Employee this[int employeeId]
{
get
{
foreach(var emp in this)
{
if (emp.EmployeeId == employeeId)
return emp;
}
return null;
}
}
public Employee this[string employeeName]
{
get
{
foreach(var emp in this)
{
if (emp.Name == employeeName)
return emp;
}
return null;
}
}
}