Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

AppDomain::Id Property

Gets an integer that uniquely identifies the application domain within the process.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

property int Id {
	int get ();

Property Value

Type: System::Int32
An integer that identifies the application domain.

The following code example creates a second application domain and displays information about the default domain and the new domain.

using namespace System;
using namespace System::Reflection;

// This method has the same signature as the CrossAppDomainDelegate, 
// so that it can be executed easily in the new application domain. 
static void ShowDomainInfo()
    AppDomain^ ad = AppDomain::CurrentDomain;
    Console::WriteLine( L"FriendlyName: {0}", ad->FriendlyName );
    Console::WriteLine( L"Id: {0}", ad->Id );
    Console::WriteLine( L"IsDefaultAppDomain: {0}", ad->IsDefaultAppDomain() );

// The following attribute indicates to the loader that assemblies 
// in the global assembly cache should be shared across multiple  
// application domains. 
int main()
    // Show information for the default application domain.

    // Create a new application domain and display its information.
    AppDomain^ newDomain = AppDomain::CreateDomain( L"MyMultiDomain" );
    newDomain->DoCallBack( gcnew CrossAppDomainDelegate( ShowDomainInfo ) );

    return 0;

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
© 2015 Microsoft