Thursday 8 November 2012

Could not find an implementation of the query pattern for source type ‘type’. ‘Join’ not found. Consider explicitly specifying the type of the range variable ‘x’.

A few days back I was trying to do a join  between a ConfigurationElementCollection class, for which I had implemented IEnumerable<T> myself. The ConfigurationElement class contained a field with a guid and I was trying to get the intersect between the configuration file and a list of guids, toBeProcessed, and then return that collection of Type items. So I tried this:
Type steps = from x in plugins.Steps
            join y in toBeProcessed on x.Id equals y
            select x;
but I got this error message:
Could not find an implementation of the query pattern for source type ‘type’. ‘Join’ not found. Consider explicitly specifying the type of the range variable ‘x’.
In order to get around this issue, it is necessary to cast plugins.Steps to Type, like this:
Type steps = from x in plugins.Steps.Cast<Type>()
            join y in toBeProcessed on x.Id equals y
            select x; 
Hope it helps.

No comments:

Post a Comment