1
AppDomain.CurrentDomain.Id
爲我們提供了當前應用程序域的「AppDomain」進程ID,但我想知道的是包含此AppDomain的容器進程的Windows進程ID。怎麼樣?AppDomain的進程ID
AppDomain.CurrentDomain.Id
爲我們提供了當前應用程序域的「AppDomain」進程ID,但我想知道的是包含此AppDomain的容器進程的Windows進程ID。怎麼樣?AppDomain的進程ID
應用程序中的所有AppDomain都在同一個窗口進程內 - 也就是您的應用程序進程中。所以你只需要:
int nProcessID = Process.GetCurrentProcess().Id;
所有AppDomain都屬於一個進程。您可以從System.Diagnostics.Process.GetCurrentProcess()中檢索此文件。Id