PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You are creating a console application by using C#.
You need to access the application assembly.
Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
Assembly.GetAssembly(this);

B.
this.GetType();

C.
Assembly.Load();

D.
Assembly.GetExecutingAssembly();

Explanation:
Assembly.GetExecutingAssembly – Gets the assembly that contains the code that is currently
executing.
http://msdn.microsoft.com/enus/library/system.reflection.assembly.getexecutingassembly(v=vs.110).aspx
Assembly.GetAssembly – Gets the currently loaded assembly in which the specified class is defined.
http://msdn.microsoft.com/en-us/library/system.reflection.assembly.getassembly.aspx

2 Comments on “Which code segment should you use?


Leave a Reply