BuildProvider.GetGeneratedType(CompilerResults) 方法
定义
返回生成提供程序从虚拟路径生成的类型。Returns a type generated by the build provider from the virtual path.
public:
virtual Type ^ GetGeneratedType(System::CodeDom::Compiler::CompilerResults ^ results);
public virtual Type GetGeneratedType (System.CodeDom.Compiler.CompilerResults results);
abstract member GetGeneratedType : System.CodeDom.Compiler.CompilerResults -> Type
override this.GetGeneratedType : System.CodeDom.Compiler.CompilerResults -> Type
Public Overridable Function GetGeneratedType (results As CompilerResults) As Type
参数
- results
- CompilerResults
生成提供程序的虚拟路径的编译结果。The compilation results for the build provider's virtual path.
返回
生成提供程序为虚拟路径生成的类型。The type that is generated by the build provider for the virtual path. 基类返回 null。The base class returns null.
注解
若要实现为 Web 内容(如 .aspx 文件)生成源代码的生成提供程序,请从类派生一个类 BuildProvider ,并重写 GetGeneratedType 方法以返回生成提供程序生成的类型。To implement a build provider that generates source code for Web content such as .aspx files, derive a class from the BuildProvider class and override the GetGeneratedType method to return the type generated by the build provider.
ASP.NET 生成系统为每个生成提供程序编译文件,并生成一个 CompilerResults 传递给方法的对象 GetGeneratedType 。The ASP.NET build system compiles files for each build provider, and generates a CompilerResults object, which is passed to the GetGeneratedType method. 通常,生成提供程序的 GetGeneratedType 实现对 GetType CompiledAssembly 输入对象的属性使用方法 results 以返回提供的类型。Typically, a build provider's GetGeneratedType implementation uses the GetType method on the CompiledAssembly property of the input results object to return the provided type.