zoukankan      html  css  js  c++  java
  • 获取当前进程当前runtime加载的appdomain

    using System.Runtime.InteropServices;
    // Add the following as a COM reference - C:WINDOWSMicrosoft.NETFrameworkvXXXXXXmscoree.tlb
    using mscoree;                              
    
            public static IList<AppDomain> GetAppDomains()
            {
                IList<AppDomain> _IList = new List<AppDomain>();
                IntPtr enumHandle = IntPtr.Zero
                ICorRuntimeHost host = new CorRuntimeHost();
                try
                {
                    host.EnumDomains(out enumHandle);
                    object domain = null;
                    while (true)
                    {
                        host.NextDomain(enumHandle, out domain);
                        if (domain == null) break;
                        AppDomain appDomain = (AppDomain)domain;
                        _IList.Add(appDomain);
                    }
                    return _IList;
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                    return null;
                }
                finally
                {
                    host.CloseEnum(enumHandle);
                    Marshal.ReleaseComObject(host);
                }
            } 
        }
  • 相关阅读:
    数据库
    php
    123
    es5新增
    正则表达式
    cookie
    Event事件下
    事件对象
    dva框架的下拉菜单的父子关系
    dva框架的table表格---删除
  • 原文地址:https://www.cnblogs.com/nanfei/p/10876876.html
Copyright © 2011-2022 走看看