开发者

User Defined ClassLoader In C#

开发者 https://www.devze.com 2023-01-12 16:59 出处:网络
Inspired by this question why do we need user defin开发者_高级运维ed classloader in java Does C# have a way of defining a way to load classes and dlls on demandYou can handle the AppDomain.AssemblyRe

Inspired by this question why do we need user defin开发者_高级运维ed classloader in java

Does C# have a way of defining a way to load classes and dlls on demand


You can handle the AppDomain.AssemblyResolve event to manually load assemblies that the runtime cannot locate by itself.


.NET offers a lot of options for resolving/configuring assembly/type names while loading. But ultimately, look at Assembly.Load & Assembly.LoadFrom methods - you may even load types from some custom storage using these methods.


No, and why would you want something like that?

The only reason I can think of is for injection/mocking.

For that you would use the .NET profiler API, and rewrite IL on the fly.

0

精彩评论

暂无评论...
验证码 换一张
取 消