1

This is another exam related question.

How can I use the AssemblyName class to represent an existing assembly that already exists on disk?

I am talking about from the perspective of using the AppDomain's instance method .Load() that takes an AssemblyName object as a parameter. I know what MSDN has to say about what the .Load() method was designed for; but that aside, I still want to know how to use it.

LittleBobbyTables - Au Revoir
  • 32,008
  • 25
  • 109
  • 114
IbrarMumtaz
  • 4,235
  • 7
  • 44
  • 63
  • So you want to know how to dynamically load an assembly using just its assembly name? – slugster May 07 '10 at 00:12
  • explain dynamically in this context??? I want to know how to load an existing assembly using an AssemblyName object as shown below (thanks to Hans). – IbrarMumtaz May 07 '10 at 00:21

1 Answers1

1

Not sure I see the question. But yeah, that can work:

  var name = new AssemblyName("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
  var asm = Assembly.Load(name);
Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • so them details you provide for the constructor those are real details of the assembly you want to load via a AssemblyName object???? if that's true? I NEED TO GIVE THAT A GO !!! – IbrarMumtaz May 07 '10 at 00:21
  • 1
    Not sure why you'd think it isn't true. But I certainly posted the snippet so you could try it for yourself. Yeah, give it a go. – Hans Passant May 07 '10 at 00:44