+3  A: 

It looks to me like this is a covariance vs. contravariance issue. Basically, an IQueryable<Vacancies> is not a sub-type of IQueryable<IFilteredEntities>, even though Vacancies implements IFilteredEntities. Thus, the line with the cast is causing a runtime error. So rather than doing the cast try this instead:

IEnumerable<IFilteredEntities> selectedListings =
    Repository.Instance._entities.Vacancies.AsQueryable()
    .OfType<IFilteredEntities>();

What this will do is project each element of the collection to an IFilteredEntities type.

Another option is to rewrite your filter methods so they use generics, like this:

public static IEnumerable<T> Filter<T>(
    IEnumerable<T> collection, IDictionary<string, string> filterParams)
    where T : IFilteredEntities
{
    ...
}

This would then allow you to pass in a collection containing any type that derives from IFilteredEntities and get back a collection of the same type. And if you're using C# 3, you don't even have to specify the type parameter if it can be implicitly determined by the compiler.

Jacob
I have edited my post at the bottom with the problems I achieve after implementing this. It does pass the line but the next part is complaining :).
bastijn
Wups, with the minor addition to change: AsQueryable() into AsEnumerable().
bastijn