Link to home
Start Free TrialLog in
Avatar of AlexFM
AlexFM

asked on

Get Module of class library

I need to find Module reference of class library where code is executed.
For example, Assembly.GetExecutingAssembly.GetModules gives list of all modules in the current process, and I need only current Dll module.
ASKER CERTIFIED SOLUTION
Avatar of Brian Mulder
Brian Mulder
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AlexFM
AlexFM

ASKER

Nice, thank you. I think this can be done in any instance function place by the following way: Module m = this.GetType().Module;
I need this to get unmanaged HNODULE handle in C++/CLI project. I will test this code later when C++ code will be ready.
that is the big difference between you and me, i need to learn a lot seeing that this is the same as the current class :)

since i was curious what would happen actually used it on the curAssembly like
curAssembly.GetType().Module which came back with mscorlib.dll

and

this.GetType().Module gave the name of the module as you said