PrepAway - Latest Free Exam Questions & Answers

How should you complete the code?

DRAG DROP
You write the following code.

You need to get the list of all the types defined in the assembly that is being executed currently.
How should you complete the code? To answer, drag the appropriate code elements to the correct
targets in the answer are
a. Each code element may be used once, more than once, or not at all. You may need to drag the
split bar between panes or scroll to view content.

PrepAway - Latest Free Exam Questions & Answers

Answer: See the explanation

Explanation:
Target 1: AppDomain
Target 2: SelectMany
Target 3: select

The AppDomain.CurrentDomain.GetAssemblies() gives you all assemblies loaded in the current
application domain.
The Assembly class provides a GetTypes() method to retrieve all types within that particular
assembly.
Example: Using Linq:
IEnumerable<Type> types =
from a in AppDomain.CurrentDomain.GetAssemblies()
from t in a.GetTypes()
select t;

http://stackoverflow.com/questions/4692340/find-types-in-all-assemblies

2 Comments on “How should you complete the code?


Leave a Reply