tags:

views:

2154

answers:

2

What exatcly is a Module? What is the difference between a module, a class and a function? How can I access a Module in c#.net?

UPDATE: I am asking this because- without using code signing, i want to calculate a cheksum of the IL code of only some particular functions (at runtime).

+6  A: 

A module is a logical collection of code within an Assembly. You can have multiple modules inside an Assembly, and each module can be written in different .NET languages (VS, as far as I'm aware, doesn't support creation of multi-module assemblies).

Assemblies contain modules. Modules contain classes. Classes contain functions.

Yes you can access assemblies, modules, classes, functions, properties, fields etc all via reflection at runtime.

A module is sub-assembly (satellite assembly).

I really don't agree with that. Any chance you pass a link that backs that up?

OJ
Hello OJ,Can i access the modules at runtime?
Pushkar
OJ, your answer is better, I was struggling to describe them.
Henk Holterman
May I suggest you edit this post to make it more of an answer to the OQ and move the critique on my answer down?
Henk Holterman
Sure :) Thank you for the feedback.
OJ
Normally (and you have no option in VS) an assembly consists of a single module. Using the command line tools you can, however, create an assembly of multiple modules (one of which will contain the whole assembly's metadata). Can be useful to allow incremental download for clickonce.
Richard
A: 

As an addition to the other answers:

The MSDN states that: "A module is a Microsoft intermediate language (MSIL) file that does not have an assembly manifest.".

Modules can be "linked" together by generating an assembly manifest using the Assembly Linker (al.exe) utility. If i remember it correctly the CLR can load individual modules for an assembly, so that only the neccessary modules get loaded.

EDIT: Found a better description of the Netmodules and why you would want them.

There is another question here on SO that touches the checksum subject. The answers mentions using the GetILAsByteArray method for getting the IL.

PHeiberg