GetAssembly() - passing in a string

G

Guest

I have a solution in Visual Studio 2005 that looks something like this:

namespace-1.class-1
namespace-2.class-2
....
namespace-n.class-n

From class-n, I'd like to do the following:

string temp = "namespace-1.class1";
Assembly d = Assembly.GetAssembly(typeof(temp));
Console.WriteLine("Assembly: {0}", d.ToString());

Of course, if I use the actual namespace/class instead of temp for the
GetAssembly() parameter it work great. Any suggestions on how to pass in the
namespace/class that my program chooses into GetAssembly()?

Thanks,
Randy
 
M

Mattias Sjögren

Of course, if I use the actual namespace/class instead of temp for the
GetAssembly() parameter it work great. Any suggestions on how to pass in the
namespace/class that my program chooses into GetAssembly()?

If you know the name of the assembly (i.e. if you have some
correspondance between namespace and assembly name) you can call
Assembly.Load.


Mattias
 

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

Top