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


C# AppDomain.GetHashCode方法代码示例

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


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

示例1: Load

        public String Load(String assembly)
        {
            String domainBase = "unknown";
            try
            {
                if (_currentDomain != null)
                {
                    AppDomain.Unload(_currentDomain);
                }

                _currentDomain = null;

                // The assembly is expected to be in the ModelMod installation directory.
                // (Unlike this app domain assembly, which must be copied into the game dir).
                // Setting appbase to this modelmod install dir allows the references
                // (fsharp, monogame, etc) to be loaded
                // without requiring them to be copied to the game dir.

                var ads = new AppDomainSetup();
                ads.ApplicationBase = Path.GetDirectoryName(assembly);
                ads.DisallowBindingRedirects = false;
                ads.DisallowCodeDownload = true;
                // use the configuration file property to specify the name of the assembly that must be loaded.
                // can't use a static field; the sandbox domain has a separate copy of all the statics.
                ads.ConfigurationFile = assembly;

                // this loader callback is needed so that we can hot-swap the assembly.
                // http://stackoverflow.com/questions/425077/how-to-delete-the-pluginassembly-after-appdomain-unloaddomain
                var d = base.CreateDomain("ImSoFriendly", null, ads);
                _currentDomain = d;
                domainBase = d.BaseDirectory;
                d.DoCallBack(new CrossAppDomainDelegate(LoaderCB));

                return ""; // empty string means no error, otherwise, its an error message
            }
            catch (Exception e)
            {
                return "Error during load. " + Environment.NewLine
                    + "Root app domain: " + AppDomain.CurrentDomain.GetHashCode() + Environment.NewLine
                    + "Sandbox domain: " + _currentDomain.GetHashCode() + Environment.NewLine
                    + "Sandbox domain base: " + domainBase + Environment.NewLine
                    + "Exception: " + e.ToString();
            }
        }
开发者ID:Tarek-Samy,项目名称:ModelMod,代码行数:44,代码来源:MMAppDomain.cs


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