zoukankan      html  css  js  c++  java
  • C#读取DLL文件获取所有类

    说明

    调用Web.dll 文件,获取其中的所有的WebService
    参考

    流程

    使用LoadFile加载外部dll文件

    重点:注意的是,如果查看的对象是外部的DLL,一定要把DLL复制到项目的调试文件夹Debug下。
    <add key="PHPWebdll" value="E:WebIISPHP_PublishinBF.Web.dll"/>
    //从dll文件中获取Assembly对象
    Assembly assembly = Assembly.LoadFile(System.Configuration.ConfigurationManager.AppSettings["PHPWebdll"].ToString());
    //获取所有的类
    Type[] types = assembly.GetExportedTypes();

    将 Web.dll相关的dll文件全部复制到程序的调试文件夹debug下面

    从E:WorkDirectoryPublicHealthPlatformPublicHealthPlatformBF.Webin
    到E:GitHubCustomCommonSoftCommonSoftinDebug

    获取所有的WebService

    思路:命名空间以"BF.Web.WebService"开头,继承"System.Web.Services.WebService"类
    string sDefaultNameSpace = "BF.Web.WebService";
    if (!string.IsNullOrEmpty(item.Namespace) && item.Namespace.StartsWith(sDefaultNameSpace) && item.BaseType.FullName == "System.Web.Services.WebService")
    {
    string sClassName=item.Name;
    }
  • 相关阅读:
    Codeforces 1182E Product Oriented Recurrence 矩阵快速幂
    Codeforces 1182D Complete Mirror hash
    HDU
    HDU
    HDU
    HDU
    HDU
    HDU
    web框架之Vue渐进式框架-安装及入门
    web框架之Jqeury基本使用
  • 原文地址:https://www.cnblogs.com/masonblog/p/12740834.html
Copyright © 2011-2022 走看看