本文整理匯總了C#中AppDomain.DoCallBack方法的典型用法代碼示例。如果您正苦於以下問題:C# AppDomain.DoCallBack方法的具體用法?C# AppDomain.DoCallBack怎麽用?C# AppDomain.DoCallBack使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AppDomain
的用法示例。
在下文中一共展示了AppDomain.DoCallBack方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Main
static int Main ()
{
AppDomain.Unload (AppDomain.CreateDomain ("Warmup unload code"));
Console.WriteLine (".");
ad = AppDomain.CreateDomain ("NewDomain");
ad.DoCallBack (Bla);
var t = new Thread (UnloadIt);
t.IsBackground = true;
t.Start ();
evt.WaitOne ();
return 0;
}
示例2: Foo
public void Foo(AppDomain
ad)
{
ad.DoCallBack
(new
CrossAppDomainDelegate
(Bar));
}
示例3: Go
public static void Go() {
// Create an AppDomain
s_ad = AppDomain.CreateDomain("AD #2", null, null);
// Spawn thread to enter the other AppDomain
Thread t = new Thread((ThreadStart)delegate { s_ad.DoCallBack(Loop); });
t.Start();
Thread.Sleep(5000); // The other thread a chance to run
Stopwatch sw = null;
try {
// Time how long it takes to unload the AppDomain
Console.WriteLine("Calling unload");
sw = Stopwatch.StartNew();
AppDomain.Unload(s_ad);
}
catch (Exception e) {
Console.WriteLine(e.ToString());
}
Console.WriteLine("Unload returned after {0}", sw.Elapsed);
Console.ReadLine();
}