⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compilerexception.cs

📁 动态执行csharp代码
💻 CS
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -