Resource Manager Question

  • Thread starter Thread starter JezB
  • Start date Start date
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 ?
 
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
 
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
 
Back
Top