exam questions

Exam 70-483 All Questions

View all questions & answers for the 70-483 exam

Exam 70-483 topic 2 question 125 discussion

Actual exam question from Microsoft's 70-483
Question #: 125
Topic #: 2
[All 70-483 Questions]

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 area. 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.
Select and Place:

Show Suggested Answer Hide Answer
Suggested Answer:
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;
Reference: http://stackoverflow.com/questions/4692340/find-types-in-all-assemblies

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
supersunny
Highly Voted 5 years, 11 months ago
1, 5, 2 confirmed by testing the app.
upvoted 36 times
JoelChuca
4 years, 9 months ago
I tried 1,5 & 2 but I got compilation error with SelectMany. List<Type> types = (AppDomain.CurrentDomain.GetAssemblies() .SelectMany(t => t.GetType()) .Where(t => t.IsClass && t.Assembly == this.GetType().Assembly)).ToList<Type>(); But with 1,4 & 2 works without error.
upvoted 2 times
...
JoelChuca
4 years, 9 months ago
Ignore my previous comment. my code had an error. confirmed 1,5,2 are OK
upvoted 3 times
...
...
dosper
Highly Voted 5 years, 10 months ago
1, 5, 2 is correct
upvoted 8 times
...
japnam
Most Recent 4 years, 5 months ago
The answer should be AppDomian Select Assembly This compiles without error List<Type> types = (AppDomain.CurrentDomain.GetAssemblies().Select(t => t.GetType()) .Where(t => t.IsClass && t.Assembly == t.GetType().Assembly)).ToList<Type>();
upvoted 2 times
...
thiemamd
4 years, 10 months ago
Tested: AppDomain SelectMany Assembly List<Type> types = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(t => t.GetTypes()) .Where(t => t.IsClass && t.Assembly == this.GetType().Assembly).ToList<Type>();
upvoted 6 times
...
WasifBhatti
4 years, 11 months ago
AppDomain,SelectMany,Assembly
upvoted 3 times
...
xman
5 years, 4 months ago
AppDomain SelectMany Assembly
upvoted 8 times
...
sscooter1010
5 years, 4 months ago
1,5, 2 is correct. confirmed by testing.
upvoted 7 times
...
elbaidwan
5 years, 5 months ago
1, 5, 2 is correct
upvoted 5 times
...
Asa
5 years, 11 months ago
Correct answer is: 1,4,2
upvoted 3 times
...
Mitsoshima
6 years ago
Correct answer is: 1,4,3
upvoted 1 times
Pedroalmeida25
4 years, 5 months ago
You're so wrong boi
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...