You work as the application developer at Domain.com.
You are working on a new application named Certkiller App05. Certkiller App05 is configured to dynamically load assemblies from the application directory.
You must define the code segment that will dynamically load an assembly named Certkiller Ass25.dll into the current application domain.
Choose the code segment which you should use to accomplish this task.
A.
AppDomain domain = AppDomain.CurrentDomain;
string myPath = Path.Combine(domain.BaseDirectory,” Certkiller Ass25.dll”);
Assembly asm = Assembly.LoadFrom(myPath);
B.
AppDomain domain = AppDomain.CurrentDomain;
string myPath = Path.Combine(domain.BaseDirectory,” Certkiller Ass25.dll “);
Assembly asm = Assembly.Load(myPath);
C.
AppDomain domain = AppDomain.CurrentDomain;
string myPath = Path.Combine(domain.DynamicDirectory,” Certkiller Ass25.dll”);
Assembly asm = AppDomain.CurrentDomain.Load(myPath);
D.
AppDomain domain = AppDomain.CurrentDomain;
Assembly asm = domain.GetData(” Certkiller Ass25.dll”);
Explanation:
The Assembly.LoadFrom() method can be called to dynamically load
an assembly from file.
B the Load method requires an AssemblyName object as a parameter. C it is not possible to use AppDomain.Load to load an assembly from file. D AppDomain.GetData gets information stored in the AppDomain for the specified assembly. It cannot load an assembly.
A