What does it mean and why (if at all) is it important?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It means you can add additional “operators” to a query. It’s important because you can do it extremely efficiently.
For example, let’s say you have a method that returns a list (enumerable) of employees:
and another method that uses that one to return all managers:
You can call that function to get managers that are approaching retirement and send them an email like this:
Pop quiz: How many times will that iterate over your employees list? The answer is exactly once; the entire operation is still just O(n)!
Also, I don’t need to have separate methods for this. I could compose a query with these steps all in one place:
One cool thing about this is that I can change is at run time, such that I can include or not include one part of the composition inside an
ifblock, such that the decision to use a specific filter is made at run time, and everything still comes out nice and pretty.