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.
精彩评论