O'Reilly logo

Applied Microsoft® .NET Framework Programming by Jeffrey Richter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Explicitly Loading Assemblies

So far, I’ve shown you how to reflect on the assemblies that are loaded into an AppDomain. Knowing how to do this is useful, but you must remember that the CLR decides when to load an assembly: the first time a method is called, the CLR examines the method’s IL code to see what types are referenced. The CLR then loads all the assemblies that define the referenced types. If a required assembly is already available in the AppDomain, the CLR knows not to load the assembly again.

But let’s say you want to write an application that counts the number of types that implement a particular interface. To accomplish this, you’d have to implement a method that references at least one type in each assembly you want loaded. Then ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required