16.4. Interacting with the Default Application Domain

Recall that when a .NET executable starts, the CLR will automatically place it into the default app domain o f the hosting process. This is done automatically and transparently, and you never have to author any specific code to do so. However, it is possible for your application to gain access to this default application domain using the static AppDomain.CurrentDomain property. Once you have this access point, you are able to hook into any events of interest, or make use of the methods and properties of AppDomain to perform some runtime diagnostics.

To learn how to interact with the default application domain, begin by creating a new Console Application named DefaultAppDomainApp. Now, update ...

Get Pro C# 2010 and the .NET 4 Platform, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.