You are creating a console application by using C#.
You need to access the assembly found in the file named car.dll.
Which code segment should you use?
A.
Assembly.Load();
B.
Assembly.GetExecutingAssembly();
C.
this.GetType();
D.
Assembly.LoadFile(“car.dll”);
Answers are wrong, or?
Correct would be “Assembly.Load(“car.dll”);”.
I believe D is the right answer..
D
I don’t understand why is D? I think it is A
https://msdn.microsoft.com/en-us/library/ky3942xh(v=vs.110).aspx
https://msdn.microsoft.com/en-us/library/25y1ya39(v=vs.110).aspx
https://msdn.microsoft.com/en-us/library/dd153782(v=vs.110).aspx
both A and D are possible, depending on where the dll is located.
Considering the default is safer, I assume A will therefore be considered correct.
Assembly.Load() expects a parameter. A cannot be the answer.
https://msdn.microsoft.com/en-us/library/system.reflection.assembly.load(v=vs.110).aspx
Assembly.LoadFile(String) – Loads the contents of an assembly file on the specified path.
Assembly.Load(String) – Loads an assembly given the long form of its name.
There is no method Assembly.Load(), so correct answer is D, but result is not an assembly, result is content of an assembly file.