AppDomain.Id Property
.NET Framework 4.5
Gets an integer that uniquely identifies the application domain within the process.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
The following code example creates a second application domain and displays information about the default domain and the new domain.
using System; using System.Reflection; public class Example { // The following attribute indicates to the loader that assemblies // in the global assembly cache should be shared across multiple // application domains. [LoaderOptimizationAttribute( LoaderOptimization.MultiDomainHost)] public static void Main() { // Show information for the default application domain. ShowDomainInfo(); // Create a new application domain and display its information. AppDomain newDomain = AppDomain.CreateDomain("MyMultiDomain"); newDomain.DoCallBack(new CrossAppDomainDelegate(ShowDomainInfo)); } // This method has the same signature as the CrossAppDomainDelegate, // so that it can be executed easily in the new application domain. // public static void ShowDomainInfo() { AppDomain ad = AppDomain.CurrentDomain; Console.WriteLine(); Console.WriteLine("FriendlyName: {0}", ad.FriendlyName); Console.WriteLine("Id: {0}", ad.Id); Console.WriteLine("IsDefaultAppDomain: {0}", ad.IsDefaultAppDomain()); } }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.