簡體   English   中英

如何在C#中找到對象的擁有程序集

[英]How Do I Find The Owning Assembly Of An Object In C#

我正在嘗試對擁有當前在我的應用程序中打開的表單的所有程序集進行一些處理。 我可以輕松地獲取表單對象:

System.Windows.Forms.Application.OpenForms

我想遍歷此列表並找到每個實例的擁有程序集。 我知道如何找到擁有給定表單類的程序集,而不是特定的類實例。

formInstance.GetType().Assembly

編輯以回應評論:

from form in Application.OpenForms
where form.Owner != null
select form.Owner.GetType().Assembly

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM