O'Reilly logo

VB.NET Core Classes in a Nutshell by Ted Neward, Budi Kurniawan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

AppDomain

Synopsis

This class represents an abstract separation within the executing process, which mimics the separation between processes running on a single machine. As a result, a single .NET process can host multiple other processes that offer the isolation found between processes, while keeping the low overhead of a single process.

Every .NET process created has at least one AppDomain, even when running a simple command shell-driven application, such as Hello, world, created by the shim code at the start of a .NET executable file. Applications that act as containers, however, can create multiple AppDomains, loading assemblies into each AppDomain independently of one another. This is, in fact, precisely how ASP.NET keeps multiple web applications separate from one another, so that an exception thrown from within one won’t tear down the entire IIS process.

Creating a new AppDomain involves using the shared CreateDomain() method. This method is overloaded four ways, but the most common use is simply to pass in a friendly name for the AppDomain. When finished with a given AppDomain, use the Unload() method to close down the AppDomain and all objects stored within it. Should a .NET programmer wish to obtain a reference to the AppDomain she is currently executing within, the shared property CurrentDomain returns the current AppDomain.

Each AppDomain contains an entirely separate list of loaded assemblies accessible via the GetAssemblies() method, which returns the list ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required