Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Building dynamic linq query

Avatar of scottlafoy
scottlafoyFlag for Canada asked on
.NET ProgrammingC#Microsoft Development
10 Comments1 Solution424 ViewsLast Modified:
I am looking to use linq on a forms project I am building for a search page I need. My project is organized into 1 object containing a collection of licenses and a collection of inspections. The license and inspections have a relationship of 1 to many. There is only 1 license per inspection but a license can belong to many inspections. I am building a search page that has many many different items that can be used to search. It can use either all of them or any 1 or combination of the search items to search. The tricky part is the search has to return a collection of inspections although half of the search items are properties in the license object and not the inspection object. Now since it would be totally crazy to build a massive switch statement to do all of this I need a starting point. How do I create a dynamic linq query?  I have not used linq yet but I have read up on using it with objects and I think I get a basic understanding of it.  If anyone could offer me some help I would be grateful.

Thank you in advance,

Scott