2013-11-21 83 views
1
AppDomain.CurrentDomain.Id 

爲我們提供了當前應用程序域的「AppDomain」進程ID,但我想知道的是包含此AppDomain的容器進程的Windows進程ID。怎麼樣?AppDomain的進程ID

回答

3

應用程序中的所有AppDomain都在同一個窗口進程內 - 也就是您的應用程序進程中。所以你只需要:

int nProcessID = Process.GetCurrentProcess().Id; 
3

所有AppDomain都屬於一個進程。您可以從System.Diagnostics.Process.GetCurrentProcess()中檢索此文件。Id