compilerexception.cs
来自「动态执行csharp代码」· CS 代码 · 共 49 行
CS
49 行
using System;
using System.Collections.Generic;
using System.Text;
using System.CodeDom.Compiler;
namespace Compiler.Dynamic
{
public class CompilerException : Exception
{
string _Code;
CompilerErrorCollection _Errors;
public string Code
{
get
{
return _Code;
}
}
public CompilerErrorCollection Errors
{
get
{
return _Errors;
}
}
public CompilerException(string code, CompilerErrorCollection errors)
{
_Code = code;
_Errors = errors;
}
public override string ToString()
{
StringBuilder message = new StringBuilder();
foreach (CompilerError err in _Errors)
{
message.AppendFormat("({0}): error {1}: {2}", err.Line, err.ErrorNumber, err.ErrorText);
}
return message.ToString();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?