public abstract beginType ( string typeName ) : string | ||
typeName | string | /// The name of the type /// |
Результат | string |
/// <summary> /// Compiles a method from the provided source with the parameters specified. /// </summary> /// <param name="compiler"> /// The compiler to use for compiling the source to MSIL. /// </param> /// <param name="methodSource"> /// The actual source of the method. /// </param> /// <param name="methodName"> /// The name of the method. /// </param> /// <param name="options"> /// The parameters to be set for the compiler. /// </param> /// <param name="language"> /// A specification of the syntax of the language of the code /// </param> /// <returns> /// The resulting method and any warnings produced by the compiler, wrapped in a MethodResults object. /// </returns> /// <exception cref="CompilationException"/> public static MethodResults CreateMethod(ICodeCompiler compiler, string methodSource, string methodName, CompilerParameters options, Language language) { string containerName = String.Format("{0}Container", methodName); StringBuilder sourceBuilder = new StringBuilder(); sourceBuilder.Append(language.beginType(containerName)); sourceBuilder.Append(methodSource); sourceBuilder.Append(language.endType(containerName)); TypeResults compiledType = CreateType(compiler, sourceBuilder.ToString(), containerName, options, language); return compiledType.GetMethod(methodName); }
/// <summary> /// Compiles a method from the provided source with the parameters specified. /// </summary> /// <param name="compiler"> /// The compiler to use for compiling the source to MSIL. /// </param> /// <param name="methodSource"> /// The actual source of the method. /// </param> /// <param name="methodName"> /// The name of the method. /// </param> /// <param name="options"> /// The parameters to be set for the compiler. /// </param> /// <param name="language"> /// A specification of the syntax of the language of the code /// </param> /// <returns> /// The resulting method and any warnings produced by the compiler, wrapped in a MethodResults object. /// </returns> /// <exception cref="CompilationException"/> public static MethodResults CreateMethod(ICodeCompiler compiler, string methodSource, string methodName, CompilerParameters options, Language language) { string containerName = String.Format("{0}Container", methodName); StringBuilder sourceBuilder = new StringBuilder(); sourceBuilder.Append(language.beginType(containerName)); sourceBuilder.Append(methodSource); sourceBuilder.Append(language.endType(containerName)); TypeResults compiledType = CreateType(compiler, sourceBuilder.ToString(), containerName, options, language); return(compiledType.GetMethod(methodName)); }