How can i use Extension Methods in boo

穿精又带淫゛_ 提交于 2019-12-22 10:29:48

问题


I have a list in my boo script and want to use System.Linq Extension Methods but boo compiler throw this Exception:

BCE0019: Boo.Lang.Compiler.CompilerError: 'ToList' is not a member of 
'System.Linq.IQueryable`1[[...]]'.

("..." is type of my object)


回答1:


What version of Boo? Extension Methods have been supported since 0.9.0. If you can't use extension methods with the version you are using, you'll have to use absolute method calls, e.g. Enumerable.Select(...).

As @Jean has said, have you also imported System.Linq?




回答2:


I should import System.Linq.Enumerable not System.Linq

thanks Jean and Matthew for your answers.



来源:https://stackoverflow.com/questions/4633977/how-can-i-use-extension-methods-in-boo

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!