eturn (Employee)alEmployees[index]; } //to use foreach IEnumerator IEnumerable.GetEnumerator() { return alEmployees.GetEnumerator(); } } The problem here is that if you have many types in you application then you need to create multiple custom collections, one for each type.