Below you will find pages that utilize the taxonomy term “Linq”
Blog
A scenario where LINQ is too dynamic (answered)
The situation I talked about in my previous posthad one very big issue: LINQ sometimes just is too dynamic… 😉
The fact that I changed the value for the Ranking property for each SpecificObject that got matched, made the primary LINQ query have a different outcome. LINQ uses lazy evaluation and because of that, the contents of finalGroups and exitGroups changed every time I changed the Ranking value for one of the SpecificObjects.
Blog
A scenario where LINQ is too dynamic
While developing an algorithm to match preferences to possibilities, I had to sort a generic list of a specific object type (SpecificObject). The first x objects would be matched, the rest would be excluded because of the number of available places. To determine the group of objects that would be matched and the group that would be excluded, I did something like this:
IEnumerablesortedObjects;IEnumerablefinalObjects; IEnumerableexitObjects; sortedObjects = from SpecificObject specificObject in AllSpecificObjectsorderby specificObject.
Blog
Selecting all the controls of a specific type, the (built in!) LINQ way
We probably all worked with dynamically generated controls on forms, ASP.NET pages or (user) controls. And I guess we’ve all written for-each statements to loop through the ControlCollection and filter out all the controls of a specific type, right? I wanted to do the same today, so I started by trying to use LINQ for this:
This, as you can see, generated a compile time error:
Could not find an implementation of the query pattern for source type ‘System.