System.CodeDom.Compiler.CodeDomProvider.CreateCompiler C# (CSharp) Метод

CreateCompiler() приватный Метод

private CreateCompiler ( ) : ICodeCompiler
Результат ICodeCompiler
        public abstract ICodeCompiler CreateCompiler();

Usage Example

Пример #1
0
		public static Assembly Compile(CodeDomProvider cp, string scriptCode, IList assemblies)
		{
			ICodeCompiler ic = cp.CreateCompiler();
			CompilerParameters cpar = GetCompilerParameters(assemblies);
			CompilerResults cr = ic.CompileAssemblyFromSource(cpar, scriptCode);

			bool errors = false;

			if (cr.Errors.Count > 0)
			{
				StringBuilder sb = new StringBuilder("Error compiling the composition script:\n");
				foreach (CompilerError ce in cr.Errors)
				{
					if (!ce.IsWarning)
					{
						errors = true;

						sb.Append("\nError number:\t")
							.Append(ce.ErrorNumber)
							.Append("\nMessage:\t ")
							.Append(ce.ErrorText)
							.Append("\nLine number:\t")
							.Append(ce.Line);
					}
				}
				if (errors)
				{
					throw new PicoCompositionException(sb.ToString());
				}
			}

			return cr.CompiledAssembly;
		}
All Usage Examples Of System.CodeDom.Compiler.CodeDomProvider::CreateCompiler