AppDomains and Objects (Revisited)

This chapter began by framing AppDomains as scopes of execution. A large part of that discussion was dedicated to portraying an AppDomain as a “home” for objects and types. In particular, an object is scoped to a particular AppDomain, and object references can refer only to objects in the same AppDomain. However, there is a slight inconsistency in the AppDomain interface that has yet to be discussed. That slight inconsistency is the SetData and GetData mechanism.

Listing 8.3 showed an example of injecting code into a foreign AppDomain. In that example, the code used the SetData and GetData mechanism to pass the number of loaded assemblies from one AppDomain to another. When one reviews the signatures of the ...

Get Essential .NET, Volume 1: The Common Language Runtime 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.