當前位置: 首頁>>代碼示例>>C#>>正文


C# AppDomain.CreateInstanceAndUnwrap方法代碼示例

本文整理匯總了C#中AppDomain.CreateInstanceAndUnwrap方法的典型用法代碼示例。如果您正苦於以下問題:C# AppDomain.CreateInstanceAndUnwrap方法的具體用法?C# AppDomain.CreateInstanceAndUnwrap怎麽用?C# AppDomain.CreateInstanceAndUnwrap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在AppDomain的用法示例。


在下文中一共展示了AppDomain.CreateInstanceAndUnwrap方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetRemote

	public static Foo GetRemote (AppDomain domain)
	{
		Foo test = (Foo) domain.CreateInstanceAndUnwrap (
			typeof (Foo).Assembly.FullName,
			typeof (Foo).FullName, new object [0]);
		return test;
	}
開發者ID:nlhepler,項目名稱:mono,代碼行數:7,代碼來源:t46-lib.cs

示例2: CreateCrossDomainTester

	static CrossDomainTester CreateCrossDomainTester (AppDomain domain)
	{
		Type testerType = typeof (CrossDomainTester);

		return (CrossDomainTester) domain.CreateInstanceAndUnwrap (
			testerType.Assembly.FullName, testerType.FullName, false,
			BindingFlags.Public | BindingFlags.Instance, null, new object [0],
			CultureInfo.InvariantCulture, new object [0], domain.Evidence);
	}
開發者ID:mono,項目名稱:gert,代碼行數:9,代碼來源:test.cs

示例3: LoadAssemblies

        public void LoadAssemblies()
        {
            if (ad != null)
            {
                System.Console.Error.WriteLine("Unloading domain");
                AppDomain.Unload(ad);
            }

            ad = AppDomain.CreateDomain("MyAppDomain");
            object o = ad.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, "CompleteSharp+MyAppDomain+Hack");
            Hack h = o as Hack;
            h.ad = this;
            int idx = 0;

            foreach (string a in assemblies)
            {
                try
                {
                    FileInfo fi = new FileInfo(a);
                    times[idx] = fi.LastWriteTime;
                    idx++;

                    System.Console.Error.WriteLine("Loading: " + a);
                    h.Load(a);
                }
                catch (Exception e)
                {
                    reportError(e);
                }
            }
        }
開發者ID:NeoTse,項目名稱:completion,代碼行數:31,代碼來源:CompleteSharp.cs

示例4: GetRemote

	static Program GetRemote (AppDomain domain)
	{
		Program test = (Program) domain.CreateInstanceAndUnwrap (
			typeof (Program).Assembly.FullName,
			typeof (Program).FullName, new object [0]);
		return test;
	}
開發者ID:nlhepler,項目名稱:mono,代碼行數:7,代碼來源:t46.cs

示例5: CreateAppDomain

        /// <summary>
        /// Creates the app-domain and the instance of the ResourceRetriever and
        /// sets the private fields with the references.
        /// </summary>
        /// 
        private void CreateAppDomain()
        {
            if (_domain == null)
            {
                // Create an app-domain to load the resource assemblies in so that they can be
                // unloaded.

                _domain = AppDomain.CreateDomain("ResourceIndirectDomain");
                _resourceRetriever =
                    (ResourceRetriever)_domain.CreateInstanceAndUnwrap(
                        Assembly.GetExecutingAssembly().FullName,
                        "System.Management.Automation.ResourceRetriever");
            }
        }
開發者ID:40a,項目名稱:PowerShell,代碼行數:19,代碼來源:RegistryStringResourceIndirect.cs


注:本文中的AppDomain.CreateInstanceAndUnwrap方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。