当前位置: 首页>>代码示例>>C#>>正文


C# AppDomain.GetAssemblies方法代码示例

本文整理汇总了C#中AppDomain.GetAssemblies方法的典型用法代码示例。如果您正苦于以下问题:C# AppDomain.GetAssemblies方法的具体用法?C# AppDomain.GetAssemblies怎么用?C# AppDomain.GetAssemblies使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AppDomain的用法示例。


在下文中一共展示了AppDomain.GetAssemblies方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ListAllAssembliesInAppDomain

 static void ListAllAssembliesInAppDomain(AppDomain domain)
 {
     Assembly[] loadedAssemblies = domain.GetAssemblies();
     Console.WriteLine("**** Here are the assemblies loaded in {0} ******\n",
             domain.FriendlyName);
     foreach (Assembly a in loadedAssemblies) {
         Console.WriteLine("-> Name: {0}", a.GetName().Name);
         Console.WriteLine("-> Version: {0}", a.GetName().Version);
     }
 }
开发者ID:walrus7521,项目名称:code,代码行数:10,代码来源:Domain.cs

示例2: ListAllAssembliesInAppDomain2

    static void ListAllAssembliesInAppDomain2(AppDomain domain)
    {
        var loadedAssemblies = from a in domain.GetAssemblies()
            orderby a.GetName().Name select a;

        Console.WriteLine("**** Here are the assemblies loaded in {0} ******\n",
                domain.FriendlyName);
        foreach (var a in loadedAssemblies) {
            Console.WriteLine("-> Name: {0}", a.GetName().Name);
            Console.WriteLine("-> Version: {0}", a.GetName().Version);
        }
    }
开发者ID:walrus7521,项目名称:code,代码行数:12,代码来源:Domain.cs

示例3: GetRuntimeAssembly

        // TODO: Evidence is obsolete but I'm not sure if it can be removed yet as this can parse assemblies from
        // prior framework versions that do use it so we'll just suppress the warning for now.
#pragma warning disable 0618

        public System.Reflection.Assembly GetRuntimeAssembly(System.Security.Policy.Evidence evidence, AppDomain targetAppDomain)
        {
            System.Reflection.Assembly result = this.cachedRuntimeAssembly == null ? null : this.cachedRuntimeAssembly.Value;
            if(result == null || evidence != null || targetAppDomain != null)
            {
                lock(this)
                {
                    if(this.cachedRuntimeAssembly != null && evidence == null && targetAppDomain == null)
                        return this.cachedRuntimeAssembly.Value;
                    if(targetAppDomain == null)
                        targetAppDomain = AppDomain.CurrentDomain;
                    if(this.Location != null)
                    {
                        string name = this.StrongName;
                        System.Reflection.Assembly[] alreadyLoadedAssemblies = targetAppDomain.GetAssemblies();
                        if(alreadyLoadedAssemblies != null)
                            for(int i = 0, n = alreadyLoadedAssemblies.Length; i < n; i++)
                            {
                                System.Reflection.Assembly a = alreadyLoadedAssemblies[i];
                                if(a == null)
                                    continue;
                                if(a.FullName == name)
                                {
                                    result = a;
                                    break;
                                }
                            }
                        if(result == null)
                        {
                            if(evidence != null)
                                result = targetAppDomain.Load(this.GetAssemblyName(), evidence);
                            else
                                result = targetAppDomain.Load(this.GetAssemblyName());
                        }
                    }

                    if(result != null && evidence == null && targetAppDomain == AppDomain.CurrentDomain)
                    {
                        this.AddCachedAssembly(result);
                        this.cachedRuntimeAssembly = new CachedRuntimeAssembly(result);
                    }
                }
            }
            return result;
        }
开发者ID:modulexcite,项目名称:SHFB-1,代码行数:49,代码来源:Nodes.cs


注:本文中的AppDomain.GetAssemblies方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。