Filter a genric list T, with a string value

I Have a list T, would like to know if I could filter this list based on a stirng which has the filter criteria.

filter string =  "Type = 'Shoes' AND Code = 'ABC' AND ProductGroup = 'InStock "

list T, T has properties
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

you can use lambda expression

List<yourType> filteredList = yourList.FindAll(x=> x.Type == "Shoes" && x.Code == "ABC" && x.ProductGroup == "InStock");
käµfm³d 👽Commented:
*No points*

I'd just add for informational purposes that p_davis' suggestion won't create new objects; it will just create a set of new references to the existing objects. This may or may not be a concern for your needs.
countrymeisterAuthor Commented:
Thank you all, but I thought I would post my solution.
I used Nuget Fastmember library to convert the list to a datatable
My string strFilter has the Filter columns which  is dynamically created based on which cell is selected in the grid.

List<P> listrecords = GetList();
                DataTable dt = new DataTable();
                using (var reader = ObjectReader.Create(listrecords))
                DataRow[] rows = dt.Select(strFilter);

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

käµfm³d 👽Commented:
May I inquire:  How are you building that filter string?
countrymeisterAuthor Commented:

I have a pivot grid, and when the user selects a cell in the grid, I find the header of the column and the row header and build my string. in the cell click event.
countrymeisterAuthor Commented:
I found my own solution
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.