查找AppDomain并获取实例 [英] Look Up AppDomain and get Instances

查看:151
本文介绍了查找AppDomain并获取实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我使用此方法
http://social.msdn.microsoft.com/Forums/en/winforms/thread/e4cfa5dd-e254-4088-8754-09dc40d4fb5b
 获取来自我的Process的所有AppDomain。

i use this Method http://social.msdn.microsoft.com/Forums/en/winforms/thread/e4cfa5dd-e254-4088-8754-09dc40d4fb5b to get all AppDomains from my Process.

在这个AppDomain中是使用CreateInstanceAndUnwrap创建的一些实例。如何从特定的AppDomain获取所有instancec?

In this AppDomain are some instances created with CreateInstanceAndUnwrap. How can i get all instancec from a specific AppDomain?

类似的东西:

IList< object> GetInstancecFromAppDomain(AppDomain pAppDomain)

IList<object> GetInstancecFromAppDomain(AppDomain pAppDomain)

有人知道吗?

推荐答案

除非你自己跟踪这些实例(在这种情况下你已经拥有了你想要获得的列表),或者你正在课堂上为这些实例做出规定你正试图得到实例,没有办法实现你所要求的那些我所知道的。即使有,这也是CLR中的一个主要错误。

Unless you are keeping track of those instances yourself (in which case you would already have the list you are trying to get), or you are making provisions for that in the class you are trying to get the instances of, there is no way to achieve what you ask for that I am aware of. And even if there were, it would be a major bug in the CLR.

幸运的是,Raymond Chen最近写了一篇关于这个主题的帖子,这意味着你会得到很多;比我可能提供的更具权威性和有趣的解释。

By a lucky accident, Raymond Chen recently wrote a post on this very subject, which means you will get a much more authoritative and amusing explanation than I could possiby provide.

享受:
旧的新事物 - "我怎样才能找到特定类型的所有物体?"

HTH

--mc

HTH
--mc


这篇关于查找AppDomain并获取实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆