Hi I have to apply filter on generic class. The sample class is as follows
public class Sample
{
List sourceList = new List();
To query with dynamic expression (as string), you can use Dynamic LINQ by Scott Gu of Microsoft.
Samples
It supports following operations
1. Select
2. Where
3. OrderBy
4. Skip
5. Take
6. GroupBy
All above operations take string as parameter.
It also has small expression language (to build selectors/predicates/etc) which is very easy to use.
Example:
var query =
db.Customers.
Where("City = @0 and Orders.Count >= @1", "London", 10).
OrderBy("CompanyName").
Select("new(CompanyName as Name, Phone)");