装配体加载后可以得到通知吗? [英] Can an assembly get notified after it has been loaded?

查看:99
本文介绍了装配体加载后可以得到通知吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在加载程序集时,我需要做一些事情.我想将该代码放入程序集本身.

I need to do some stuff when an assembly is loaded.  I would like to put that code into the assembly itself.

是否有特定的委托让AppDomain调用程序集以通知它已被加载?程序集如何使CLR知道要通知其加载情况?

Is there a particular delegate that the AppDomain will call on an assembly to notify it that it's been loaded?  How can an assembly make it known to the CLR that it wants to be notified of its loading?

请注意,这与通过AssemblyLoad事件注册的某些其他AssemblyLoadEventHandler委托不同-我希望正在加载的程序集被通知已被加载.

Note that this is different than some other AssemblyLoadEventHandler delegate that is registered via the AssemblyLoad event -- I want the assembly being loaded to be notified that it has been loaded.

-马修

 

推荐答案

或者,如果我可以注册在之前程序集已加载,就足够了.

Alternatively, if I could register a delegate that could be called before an assembly were loaded, that would suffice.

-matthew


这篇关于装配体加载后可以得到通知吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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