An assembly can consist of several modules and even split into several files.
There are two main options for using modules:
- Combining modules written in different languages ββ/ compiled by different compilers in one assembly
- Optimization of application loading speed with the help of a lightweight main module and additional types of loading on demand.
Modules are partly an artifact of the times when the .NET team considered it important that users could download assemblies over the network to their local machine for execution.
To save bandwidth, the assembly can be divided into several files, each of which contains a module. The assembly file containing the main or main module contains the assembly manifest , which indicates the location of all other assembly files. This allows the developer to provide quick initial loading of the main assembly, and runtime loads types or resources from other modules in the assembly on demand.
If you're interested, you can actually instruct the C # compiler to leak out the modules and compile them manually using the assembly linker. Here's a tutorial on MSDN .
Most assemblies today are single-module assemblies containing only the main module. If you are not writing Reflection (or raw IL) dedicated code for life (I did some time ago), you'll be fine if you just execute assembly.MainModule when necessary. I am sure that the number of people using multil-file / multi-module is Ι (only slightly more than 0).
Johannes Rudolph
source share