You are developing code for an application that retrieves information about Microsoft .NET
Framework assemblies.
The following code segment is part of the application (line numbers are included for reference only):
You need to insert code at line 04. The code must load the assembly. Once the assembly is loaded,
the code must be able to read the assembly metadata, but the code must be denied access from
executing code from the assembly.
Which code segment should you insert at line 04?

A.
Assembly.ReflectionOnlyLoadFrom(bytes);
B.
Assembly.ReflectionOniyLoad(bytes);
C.
Assembly.Load(bytes);
D.
Assembly.LoadFrom(bytes);
C is wrong – https://msdn.microsoft.com/en-us/library/h538bck7(v=vs.110).aspx
A – has wrong parameter (bytes), it should be string
correct answer is B
3
0
B
1
0
A & B
The ReflectionOnlyLoad and ReflectionOnlyLoadFrom methods enable you to load an assembly for reflection, but not for execution.
https://msdn.microsoft.com/en-us/library/system.reflection.assembly(v=vs.110).aspx
0
0
but the answer is B, since it’s should load from a variable.
0
0
B
1
0
Answer should be B.
1) Load does allow executing code from the assembly
2) ReflectionOnlyLoadFrom and ReflectionOnlyLoad deny executing code from the assembly
3) But only ReflectionOnlyLoad accepts byte[] as parameters, while ReflectionOnlyLoadFrom does not
Thus answer should be B.
1
0
excellent answer by wujing
0
0
“Once the assembly is loaded, the code must be able to read the assembly metadata, but the code must be denied access from executing code from the assembly.” Isn’t that ReflectionOnlyLoad method?
0
0