Resources

  • Thread starter Thread starter Mystique
  • Start date Start date
M

Mystique

How can i read resources/strings from one EXE to another?

When I read from the current EXE I use:

ResMng = new ResourceManager("MyClient.Source.MyStringsEN",
Assembly.GetExecutingAssembly());

So I suppose it should be something like this:

ResMng = new ResourceManager("MyClient.Source.MyStringsEN",
Assembly.GetAssembly( ??? ));

I just don't know what to set for GetAssembly( ??? )

thx
 
Hi Mystique,

Not sure I entirely understand your question. I think you're asking how to
load resources from an assembly other than the currently executing one . . .
?

If so, all you need is a reference to the assembly from which you would like
to load resources. You can get this in one of these ways:

- Assembly.Load("name");
- typeof(ContainedType).Assembly;

The first mechanism relies on you knowing only the name of the assembly
containing the resources you would like to load. Don't worry about
performance issues. If the assembly has been loaded already, the Load()
method does not reload it - it simply returns a reference to the existing
Assembly object.

The second mechanism requires that you know a type defined in the assembly
containing the resources you would like to load. This approach will ensure
any errors are trapped at compile time. Of course, if you move the type you
refer to into another assembly, you're in trouble . . .

Regards,
Kent
 
Back
Top