哪个DLL包含泛型扩展方法?

tbi*_*hel 3 c# dll extension-methods

我正在尝试使用CodeDom.Compiler来动态编译源代码,这意味着我需要手动引用基本程序集.我正在编译的源代码必须能够访问基本列表扩展方法,例如,Max(),Min()或Sum(),以及可能的lambda表达式.

当我编译源代码时,它说我缺少所需的程序集...目前我包含System.dll和System.Core.dll.

我需要哪个dll才能获得泛型的扩展方法?

R. *_*des 8

看看这篇博客文章.在调用CSharpCodeProvider 接收字典构造函数时,必须手动指定编译器版本.像这样:

var provider = new CSharpCodeProvider(new Dictionary<string, string>{
                                       {"CompilerVersion", "v3.5"} });
Run Code Online (Sandbox Code Playgroud)