Skip to Main Content
C# in a Nutshell, Second Edition
book

C# in a Nutshell, Second Edition

by Peter Drayton, Ben Albahari, Ted Neward
August 2003
Intermediate to advanced content levelIntermediate to advanced
928 pages
32h 1m
English
O'Reilly Media, Inc.
Content preview from C# in a Nutshell, Second Edition

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 static 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 static 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 of assemblies ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# in a Nutshell

C# in a Nutshell

Ben Albahari, Ted Neward, Peter Drayton
C# 7.0 in a Nutshell

C# 7.0 in a Nutshell

Joseph Albahari, Ben Albahari
C# Cookbook, 2nd Edition

C# Cookbook, 2nd Edition

Jay Hilyard, Stephen Teilhet
C# Cookbook

C# Cookbook

Stephen Teilhet, Jay Hilyard

Publisher Resources

ISBN: 0596005261Catalog PageErrata