Wednesday 9 January 2013

How to load types from a reference into memory

Thanks to the JIT, references are only loaded into memory once required.  Here’s how to access them before they are required:

AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += (sender, resolveArgs) => Assembly.ReflectionOnlyLoad(resolveArgs.Name);
var types = Assembly.ReflectionOnlyLoad("DllNameGoesHere").GetExportedTypes();

No comments:

Post a Comment