像这样的东西:
public static class ExtensionMethods
{
public static IQueryable<MovieList> FilterEntityCollection(this IQueryable<MovieList> movies, IEnumerable<Foo.Models.FilterCriteria> filters)
{
foreach (var filter in filters)
{
// Apply the filter to the collection.
movies= movies.Where(x => x.filter.FieldName == filter.expr);
//x."MovieTitle" == "Jaws"
}
return movies;
}
}
这样的事情可以在 C# 中完成吗?