Share via


Application Domains and Threads 

An application ___domain forms an isolation boundary for security, versioning, reliability, and unloading of managed code. Threads are the operating system construct used by the common language runtime to execute code. At run time, all managed code is loaded into an application ___domain and is run by a managed thread.

There is not a one-to-one correlation between application domains and threads. Several threads can be executing in a single application ___domain at any given time and a particular thread is not confined to a single application ___domain. That is, threads are free to cross application ___domain boundaries; a new thread is not created for each application ___domain.

At any given time, every thread is executing in an application ___domain. Zero, one, or more than one thread might be executing in any given application ___domain. The run time keeps track of which threads are running in which application domains. You can locate the ___domain in which a thread is executing at any time by calling the GetDomain method.

Application Domains and Cultures

You can attach a CultureInfo object to a thread. However, to prevent malicious code from entering other application domains, the CultureInfo object is automatically set to read-only when its thread crosses an application ___domain boundary.

If the CultureInfo object was customized, such as with a customized Calendar, an InvalidOperationException is thrown when the thread attempts to cross an application ___domain boundary.

See Also

Reference

Thread.GetDomain Method

Other Resources

Application Domains