I have created a subclass of a generic list so that I could implement a new interface
public class CustomersCollection : List<Customer>, IEnumerable<SqlDataRecord>
{
...
}
When I change the field definition to the new class (see example of old and new lines below) I get all sorts of compile errors on things that should exist in the original list.
public CustomersCollection Customers { get; set; }
public void Sample()
{
Console.WriteLine(Customers.Where(x=>x.condition).First().ToString());
}
Why does CustomersCollection does not inherit the IQueryable, IEnumerable interface implementations for List?
The official error is:
'CustomersCollection' does not contain a definition for 'Where' and no extension method 'Where' accepting a first argument of type 'CustomersCollection' could be found (are you missing a using directive or an assembly reference?)
It turns out that the custom implementation of IEnumerable causes all the extension methods that apply to IEnumerable to fail. Whats going on here?