GetAssembly() - passing in a string

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