AppDomain.CurrentDomain-Eigenschaft
Ruft die aktuelle Anwendungsdomäne für den aktuellen Thread ab.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public Shared ReadOnly Property CurrentDomain As AppDomain
'Usage
Dim value As AppDomain
value = AppDomain.CurrentDomain
public static AppDomain CurrentDomain { get; }
public:
static property AppDomain^ CurrentDomain {
AppDomain^ get ();
}
/** @property */
public static AppDomain get_CurrentDomain ()
public static function get CurrentDomain () : AppDomain
Eigenschaftenwert
Die aktuelle Anwendungsdomäne.
Beispiel
Imports System
Imports System.Reflection
Imports System.Security.Policy 'for evidence object
Class ADSetupInformation
Public Shared Sub Main()
' Create the applcation domain setup information.
Dim domaininfo As New AppDomainSetup()
domaininfo.ApplicationBase = System.Environment.CurrentDirectory
'Create evidence for the new appdomain.
Dim adevidence As Evidence = AppDomain.CurrentDomain.Evidence
' Create the new application domain using setup information.
Dim domain As AppDomain = AppDomain.CreateDomain("MyDomain", adevidence, domaininfo)
' Write out the application domain information.
Console.WriteLine(("Host domain: " + AppDomain.CurrentDomain.FriendlyName))
Console.WriteLine(("new child domain: " + domain.FriendlyName))
Console.WriteLine()
Console.WriteLine(("Application base is: " + domain.SetupInformation.ApplicationBase))
AppDomain.Unload(domain)
End Sub 'Main
End Class 'ADSetupInformation
using System;
using System.Reflection;
using System.Security.Policy; //for evidence object
class ADSetupInformation
{
public static void Main()
{
//Create the application domain setup information.
AppDomainSetup domaininfo = new AppDomainSetup();
domaininfo.ApplicationBase = System.Environment.CurrentDirectory;
//Create evidence for new appdomain.
Evidence adevidence = AppDomain.CurrentDomain.Evidence;
// Create the new application domain using setup information.
AppDomain domain = AppDomain.CreateDomain("MyDomain", adevidence, domaininfo);
// Write out the application domain information.
Console.WriteLine("Host domain: " + AppDomain.CurrentDomain.FriendlyName);
Console.WriteLine("new child domain: " + domain.FriendlyName);
Console.WriteLine();
Console.WriteLine("Application base is: " + domain.SetupInformation.ApplicationBase);
AppDomain.Unload(domain);
}
}
using namespace System;
using namespace System::Reflection;
using namespace System::Security::Policy;
//for evidence Object
int main()
{
//Create the application domain setup information.
AppDomainSetup^ domaininfo = gcnew AppDomainSetup;
domaininfo->ApplicationBase = System::Environment::CurrentDirectory;
//Create evidence for new appdomain.
Evidence^ adevidence = AppDomain::CurrentDomain->Evidence;
// Create the new application domain using setup information.
AppDomain^ domain = AppDomain::CreateDomain( "MyDomain", adevidence, domaininfo );
// Write Out the application domain information.
Console::WriteLine( "Host domain: {0}", AppDomain::CurrentDomain->FriendlyName );
Console::WriteLine( "new child domain: {0}", domain->FriendlyName );
Console::WriteLine();
Console::WriteLine( "Application base is: {0}", domain->SetupInformation->ApplicationBase );
AppDomain::Unload( domain );
}
import System.*;
import System.Reflection.*;
import System.Security.Policy.*; //for evidence object
class ADSetupInformation
{
public static void main(String[] args)
{
//Create the application domain setup information.
AppDomainSetup domainInfo = new AppDomainSetup();
domainInfo.set_ApplicationBase(System.Environment.get_CurrentDirectory());
//Create evidence for new appdomain.
Evidence adEvidence = AppDomain.get_CurrentDomain().get_Evidence();
// Create the new application domain using setup information.
AppDomain domain = AppDomain.CreateDomain("MyDomain", adEvidence,
domainInfo);
// Write out the application domain information.
Console.WriteLine("Host domain: "
+ AppDomain.get_CurrentDomain().get_FriendlyName());
Console.WriteLine("new child domain: "
+ domain.get_FriendlyName());
Console.WriteLine();
Console.WriteLine("Application base is: "
+ domain.get_SetupInformation().get_ApplicationBase());
AppDomain.Unload(domain);
} //main
} //ADSetupInformation
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
.NET Compact Framework
Unterstützt in: 2.0