Resource Manager Question

J

JezB

I have an assembly eg. myProject in which I call a class method in a library
assembly WinLib. Within that method I want to read a resource file from the
calling class's assembly (rather than within the WinLib assembly itself).
The code
ResourceManager man = new
ResourceManager(resxName,Assembly.GetExecutingAssembly());

tries to open the resource file from the WinLib assembly. How can I redirect
it to the myProject assembly (or whatever assembly called the library
routine) ?

Do I have to pass in the full name of the calling assembly or can it be
obtained within WinLib generically ?
 
K

Kent Boogaart

JezB,

There may be a more elegant solution to this but here is my late night one:

StackTrace st = new StackTrace(1);
Assembly a = st.GetFrame(0).GetMethod().DeclaringType.Assembly;

//now use a

HTH,
Kent
 
J

JezB

That seems to work !
Cheers.

Kent Boogaart said:
JezB,

There may be a more elegant solution to this but here is my late night one:

StackTrace st = new StackTrace(1);
Assembly a = st.GetFrame(0).GetMethod().DeclaringType.Assembly;

//now use a

HTH,
Kent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,212
Latest member
BrennaCaba

Latest Threads

Top