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

📄 referenceincode.cs

📁 动态执行csharp代码
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;

namespace Compiler.Dynamic.Text
{
    internal class ReferenceInCode
    {
        static readonly string[] _SystemSpecRefs = 
        {
            "System.Configuration",
            "System.Configuration.Install",
            "System.Data",
            "System.Data.SqlClient",
            "System.Data.SqlXml",
            "System.Deployment",
            "System.Design",
            "Sysemt.DirecoryServices",
            "System.DirectoryServices.Protocols",
            "System.Drawing",
            "System.Drawing.Design",
            "System.EnterpriseServices",
            "System.Management",
            "System.Messaging",
            "System.Runtime.Remoting",
            "System.Runtime.Serialization.Formatters.Soap",
            "System.Security",
            "System.ServiceProcess",
            "System.Transactions",
            "System.Web",
            "System.Web.Mobile",
            "System.Web.RegularExpressions",
            "System.Web.Services",
            "System.Windows.Forms",
            "System.Xml",
        };

        static private string GetSystemReferenceDllName(string namespaceText)
        {
            foreach (string sysSpecRef in _SystemSpecRefs)
            {
                if (namespaceText.IndexOf(sysSpecRef) == 0)
                {
                    return sysSpecRef + ".dll";
                }
            }

            return "System.dll";
        }

        static public List<string> GetNameSpacesInSourceCode(string code)
        {
            return Regx.GetMatchStrings(code, @"using\s+(.+?)\s*;", false);
        }

        static public string GetDefaultReferenceDllName(string namespaceText)
        {
            namespaceText = namespaceText.Trim();

            if (namespaceText.IndexOf("System") == 0)
            {
                return GetSystemReferenceDllName(namespaceText);
            }
            else
            {
                return namespaceText + ".dll";
            }

        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -