Last post Feb 03, 2015 07:24 AM by AidyF
Feb 03, 2015 04:45 AM|damon2012|LINK
Hi I have a ling query which I need to filter several time based on a name value.
Resharper warns that of "multiple enumeration of ienumerable". This is suppose to be inefficient.
It converted it to this:
var query= myQueryS as IList ?? myQuery.ToList();
Question is what is "query" now and how do you actually get the results you need from it?
Feb 03, 2015 05:42 AM|AidyF|LINK
Hover over "var" in Visual Studio and the pop-up will tell you what query is. If myQueryS is IEnumerable<T> then query will be List<T>. You get results from it the same way you do IEnumerable. It would help if you posted some of the relevant code.
Feb 03, 2015 06:20 AM|damon2012|LINK
When I hover over it I see the list of results, lots of rows.
But it does not allow me to do a .select on it?
Feb 03, 2015 06:56 AM|AidyF|LINK
Do you have
at the top of your code file?
Feb 03, 2015 07:15 AM|damon2012|LINK
Yep got that
Feb 03, 2015 07:24 AM|AidyF|LINK
Chances are whatever myQueryS is can be converted to IList which is non-generic, and the methods like Select work on the generic IList<T>
var query= myQuery.ToList();
that will ensure query is List<T>