I am trying to create a generic method that takes three parameters. 1) List collection 2) String PropertyName 3) String FilterString
The idea is we pass a collection of Objects, the name of the property of the object and a Filter Criteria and it returns back a list of Objects where the property contains the FilterString.
Also, the PropertyName is optional so if its not supplied I would like to return all objects that contain the FilterString in any property.
Any pointers on this would be really helpful.
I am trying to have a method signature like this: public static List FilterList(List collection, String FilterString, String Property = "")
This way I can call this method from anywhere and pass it any List and it would return me a filtered list.