What can you do to achieve this objective?

You have recently created an application domain for Domain.com.
A few weeks later you are asked to retrieve information from this application domain, which is the current application domain.
What can you do to achieve this objective? (Choose two)

You have recently created an application domain for Domain.com.
A few weeks later you are asked to retrieve information from this application domain, which is the current application domain.
What can you do to achieve this objective? (Choose two)

A.
Use the following code:
AppDomain appInfo = ApplicationDomain.Current;

B.
Use the following code:
AppDomain appInfo = AppDomain.CurrentDomain;

C.
Use the following code:
AppDomain appInfo = Thread.GetDomain();

D.
Use the following code:
AppDomain appInfo = MainThread.GetDomain();

Explanation:
The CurrentDomain property of the AppDomain class is a read-only property that contains the application domain for the current thread. You can also use the GetDomain method of the Thread class to return the application domain for the thread that is currently running. Using either of these lines of code will return an AppDomain object for the currently running application from which you can retrieve information.
Incorrect Answers:
A, D: If you use any of these codes it will result in a syntax error because the .NET class libraries do not provide an ApplicationDomain or MainThread class.



Leave a Reply 1

Your email address will not be published. Required fields are marked *