Hi friends
What exactly is a module when we say there are multiple modules in the assemblies and we use the get modules method in reflection.What actually does it retrieve
Thanks
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jaish MathewsRank #225 · 11K reputationPosted May 10, 2010, 2:24 AM EDT
Theory
A module is a portable executable file, such as type.dll or application.exe, consisting of one or more classes and interfaces. There may be multiple namespaces contained in a single module, and a namespace may span multiple modules.
One or more modules deployed as a unit compose an assembly.
Note that a .NET Framework module is not the same as a module in Visual Basic, which is used by a programmers to organize functions and subroutines in an application.
http://msdn.microsoft.com/en-us/library/system.reflection.module.aspx
Practical Example
We have a solution with 2 projects with classes
1st project has below classes. This is a new WindowsForm project
public partial class Form1 : Form
{
}
2nd project has below class. This is a new clas library
public class Class2
{
}
Now build solution as it will build our 2 projects
Below is the code to get the Module name for our 1st project class and you will get "WindowsFormsApplication1.exe" , project compiled file name
Form1 frm = new Form1();
Module m1 = frm.GetType().Module;
Below is the code to get the Module name for our 2nd project class and you will get "ClassLibrary1.dll" , project compiled file name
Class2 c1 = new Class2();
Module m = c1.GetType().Module;
Vipul KelkarRank #1,061 · 1.8K reputationPosted May 10, 2010, 2:30 AM EDT