|
Cet article a fait l'objet d'une traduction automatique. Déplacez votre pointeur sur les phrases de l'article pour voir la version originale de ce texte. Informations supplémentaires.
|
Traduction
Source
|
AppDomain, classe
Espace de noms : System
Assembly : mscorlib (dans mscorlib.dll)
Le type AppDomain expose les membres suivants.
| Nom | Description | |
|---|---|---|
![]() | ActivationContext | |
![]() | ApplicationIdentity | |
![]() | ApplicationTrust | |
![]() | BaseDirectory | |
![]() ![]() ![]() | CurrentDomain | |
![]() | DomainManager | |
![]() | DynamicDirectory | |
![]() | Evidence | |
![]() ![]() | FriendlyName | |
![]() | Id | |
![]() | IsFullyTrusted | |
![]() | IsHomogenous | |
![]() ![]() | MonitoringIsEnabled | |
![]() | MonitoringSurvivedMemorySize | |
![]() ![]() | MonitoringSurvivedProcessMemorySize | |
![]() | MonitoringTotalAllocatedMemorySize | |
![]() | MonitoringTotalProcessorTime | |
![]() | PermissionSet | |
![]() | RelativeSearchPath | |
![]() | SetupInformation | |
![]() | ShadowCopyFiles |
| Nom | Description | |
|---|---|---|
![]() | AppendPrivatePath | Obsolète. |
![]() | ApplyPolicy | |
![]() | ClearPrivatePath | Obsolète. |
![]() | ClearShadowCopyPath | Obsolète. |
![]() | CreateComInstanceFrom(String, String) | |
![]() | CreateComInstanceFrom(String, String, Byte[], AssemblyHashAlgorithm) | |
![]() ![]() ![]() | CreateDomain(String) | |
![]() ![]() ![]() | CreateDomain(String, Evidence) | |
![]() ![]() | CreateDomain(String, Evidence, AppDomainSetup) | |
![]() ![]() | CreateDomain(String, Evidence, AppDomainSetup, PermissionSet, StrongName[]) | |
![]() ![]() | CreateDomain(String, Evidence, String, String, Boolean) | |
![]() ![]() | CreateDomain(String, Evidence, String, String, Boolean, AppDomainInitializer, String[]) | |
![]() | CreateInstance(String, String) | |
![]() | CreateInstance(String, String, Object[]) | |
![]() | CreateInstance(String, String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[]) | |
![]() | CreateInstance(String, String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[], Evidence) | Obsolète. |
![]() | CreateInstanceAndUnwrap(String, String) | |
![]() | CreateInstanceAndUnwrap(String, String, Object[]) | |
![]() | CreateInstanceAndUnwrap(String, String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[]) | |
![]() | CreateInstanceAndUnwrap(String, String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[], Evidence) | Obsolète. |
![]() | CreateInstanceFrom(String, String) | |
![]() | CreateInstanceFrom(String, String, Object[]) | |
![]() | CreateInstanceFrom(String, String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[]) | |
![]() | CreateInstanceFrom(String, String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[], Evidence) | Obsolète. |
![]() | CreateInstanceFromAndUnwrap(String, String) | |
![]() | CreateInstanceFromAndUnwrap(String, String, Object[]) | |
![]() | CreateInstanceFromAndUnwrap(String, String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[]) | |
![]() | CreateInstanceFromAndUnwrap(String, String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[], Evidence) | Obsolète. |
![]() | CreateObjRef | |
![]() | DefineDynamicAssembly(AssemblyName, AssemblyBuilderAccess) | |
![]() | DefineDynamicAssembly(AssemblyName, AssemblyBuilderAccess, IEnumerable<CustomAttributeBuilder>) | |
![]() | DefineDynamicAssembly(AssemblyName, AssemblyBuilderAccess, Evidence) | Obsolète. |
![]() | DefineDynamicAssembly(AssemblyName, AssemblyBuilderAccess, String) | |
![]() | DefineDynamicAssembly(AssemblyName, AssemblyBuilderAccess, IEnumerable<CustomAttributeBuilder>, SecurityContextSource) | |
![]() | DefineDynamicAssembly(AssemblyName, AssemblyBuilderAccess, String, Evidence) | Obsolète. |
![]() | DefineDynamicAssembly(AssemblyName, AssemblyBuilderAccess, PermissionSet, PermissionSet, PermissionSet) | Obsolète. |
![]() | DefineDynamicAssembly(AssemblyName, AssemblyBuilderAccess, String, Boolean, IEnumerable<CustomAttributeBuilder>) | |
![]() | DefineDynamicAssembly(AssemblyName, AssemblyBuilderAccess, Evidence, PermissionSet, PermissionSet, PermissionSet) | Obsolète. |
![]() | DefineDynamicAssembly(AssemblyName, AssemblyBuilderAccess, String, PermissionSet, PermissionSet, PermissionSet) | Obsolète. |
![]() | DefineDynamicAssembly(AssemblyName, AssemblyBuilderAccess, String, Evidence, PermissionSet, PermissionSet, PermissionSet) | Obsolète. |
![]() | DefineDynamicAssembly(AssemblyName, AssemblyBuilderAccess, String, Evidence, PermissionSet, PermissionSet, PermissionSet, Boolean) | Obsolète. |
![]() | DefineDynamicAssembly(AssemblyName, AssemblyBuilderAccess, String, Evidence, PermissionSet, PermissionSet, PermissionSet, Boolean, IEnumerable<CustomAttributeBuilder>) | Obsolète. |
![]() | DoCallBack | |
![]() ![]() | Equals(Object) | |
![]() ![]() | ExecuteAssembly(String) | |
![]() | ExecuteAssembly(String, Evidence) | Obsolète. |
![]() | ExecuteAssembly(String, String[]) | |
![]() ![]() | ExecuteAssembly(String, Evidence, String[]) | Obsolète. |
![]() | ExecuteAssembly(String, String[], Byte[], AssemblyHashAlgorithm) | |
![]() | ExecuteAssembly(String, Evidence, String[], Byte[], AssemblyHashAlgorithm) | Obsolète. |
![]() | ExecuteAssemblyByName(String) | |
![]() | ExecuteAssemblyByName(AssemblyName, String[]) | |
![]() | ExecuteAssemblyByName(String, Evidence) | Obsolète. |
![]() | ExecuteAssemblyByName(String, String[]) | |
![]() | ExecuteAssemblyByName(AssemblyName, Evidence, String[]) | Obsolète. |
![]() | ExecuteAssemblyByName(String, Evidence, String[]) | Obsolète. |
![]() | GetAssemblies | |
![]() ![]() | GetCurrentThreadId | Obsolète. |
![]() | GetData | |
![]() ![]() | GetHashCode | |
![]() | GetLifetimeService | |
![]() ![]() | GetType | Dans XNA Framework 3.0, ce membre est hérité de Object.GetType(). |
![]() | InitializeLifetimeService | |
![]() | IsCompatibilitySwitchSet | |
![]() | IsDefaultAppDomain | |
![]() | IsFinalizingForUnload | |
![]() | Load(AssemblyName) | |
![]() | Load(Byte[]) | |
![]() | Load(String) | |
![]() | Load(AssemblyName, Evidence) | Obsolète. |
![]() | Load(Byte[], Byte[]) | |
![]() | Load(String, Evidence) | Obsolète. |
![]() | Load(Byte[], Byte[], Evidence) | Obsolète. |
![]() | ReflectionOnlyGetAssemblies | |
![]() | SetAppDomainPolicy | Obsolète. |
![]() | SetCachePath | Obsolète. |
![]() | SetData(String, Object) | |
![]() | SetData(String, Object, IPermission) | |
![]() | SetDynamicBase | Obsolète. |
![]() | SetPrincipalPolicy | |
![]() | SetShadowCopyFiles | Obsolète. |
![]() | SetShadowCopyPath | Obsolète. |
![]() | SetThreadPrincipal | |
![]() ![]() | ToString | |
![]() ![]() ![]() | Unload |
| Nom | Description | |
|---|---|---|
![]() | AssemblyLoad | |
![]() | AssemblyResolve | |
![]() | DomainUnload | |
![]() | FirstChanceException | |
![]() | ProcessExit | |
![]() | ReflectionOnlyAssemblyResolve | |
![]() | ResourceResolve | |
![]() | TypeResolve | |
![]() ![]() | UnhandledException |
| Nom | Description | |
|---|---|---|
![]() ![]() | _AppDomain.GetIDsOfNames | |
![]() ![]() | _AppDomain.GetTypeInfo | |
![]() ![]() | _AppDomain.GetTypeInfoCount | |
![]() ![]() | _AppDomain.Invoke |
Utilisez les domaines d'application pour isoler les tâches qui peuvent interrompre un processus. Si l'état du AppDomain qui exécute une tâche devient instable, le AppDomain peut être déchargé sans affecter le processus. C'est important lorsqu'un processus doit s'exécuter pendant de longues périodes sans redémarrer. Vous pouvez également utiliser les domaines d'application pour isoler les tâches qui ne doivent pas partager de données. Si un assembly est chargé dans le domaine d'application par défaut, il ne peut pas être déchargé de la mémoire tant que le processus s'exécute. Toutefois, si vous ouvrez un deuxième domaine d'application pour charger et exécuter l'assembly, l'assembly est déchargé lorsque ce domaine d'application est déchargé. Utilisez cette technique pour réduire le jeu de travail des longs processus qui utilisent parfois des DLL volumineuses.
Attention |
|---|
| Topic | Location |
|---|---|
| Comment : charger des assemblys dans un domaine d'application | .NET Framework : notions de base de la programmation |
| Comment : configurer un domaine d'application | .NET Framework : notions de base de la programmation |
| Comment : décharger un domaine d'application | .NET Framework : notions de base de la programmation |
| Comment : créer un domaine d'application | .NET Framework : notions de base de la programmation |
| Comment : configurer un domaine d'application | .NET Framework : notions de base de la programmation |
| Comment : charger des assemblys dans un domaine d'application | .NET Framework : notions de base de la programmation |
| Comment : créer un domaine d'application | .NET Framework : notions de base de la programmation |
| Comment : décharger un domaine d'application | .NET Framework : notions de base de la programmation |
using System; using System.Reflection; using System.Threading; class Module1 { public static void Main() { // Get and display the friendly name of the default AppDomain. string callingDomainName = Thread.GetDomain().FriendlyName; Console.WriteLine(callingDomainName); // Get and display the full name of the EXE assembly. string exeAssembly = Assembly.GetEntryAssembly().FullName; Console.WriteLine(exeAssembly); // Construct and initialize settings for a second AppDomain. AppDomainSetup ads = new AppDomainSetup(); ads.ApplicationBase = System.Environment.CurrentDirectory; ads.DisallowBindingRedirects = false; ads.DisallowCodeDownload = true; ads.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; // Create the second AppDomain. AppDomain ad2 = AppDomain.CreateDomain("AD #2", null, ads); // Create an instance of MarshalbyRefType in the second AppDomain. // A proxy to the object is returned. MarshalByRefType mbrt = (MarshalByRefType) ad2.CreateInstanceAndUnwrap( exeAssembly, typeof(MarshalByRefType).FullName ); // Call a method on the object via the proxy, passing the // default AppDomain's friendly name in as a parameter. mbrt.SomeMethod(callingDomainName); // Unload the second AppDomain. This deletes its object and // invalidates the proxy object. AppDomain.Unload(ad2); try { // Call the method again. Note that this time it fails // because the second AppDomain was unloaded. mbrt.SomeMethod(callingDomainName); Console.WriteLine("Sucessful call."); } catch(AppDomainUnloadedException) { Console.WriteLine("Failed call; this is expected."); } } } // Because this class is derived from MarshalByRefObject, a proxy // to a MarshalByRefType object can be returned across an AppDomain // boundary. public class MarshalByRefType : MarshalByRefObject { // Call this method via a proxy. public void SomeMethod(string callingDomainName) { // Get this AppDomain's settings and display some of them. AppDomainSetup ads = AppDomain.CurrentDomain.SetupInformation; Console.WriteLine("AppName={0}, AppBase={1}, ConfigFile={2}", ads.ApplicationName, ads.ApplicationBase, ads.ConfigurationFile ); // Display the name of the calling AppDomain and the name // of the second domain. // NOTE: The application's thread has transitioned between // AppDomains. Console.WriteLine("Calling from '{0}' to '{1}'.", callingDomainName, Thread.GetDomain().FriendlyName ); } } /* This code produces output similar to the following: AppDomainX.exe AppDomainX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null AppName=, AppBase=C:\AppDomain\bin, ConfigFile=C:\AppDomain\bin\AppDomainX.exe.config Calling from 'AppDomainX.exe' to 'AD #2'. Failed call; this is expected. */
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (rôle principal du serveur non pris en charge), Windows Server 2008 R2 (rôle principal du serveur pris en charge avec SP1 ou version ultérieure ; Itanium non pris en charge)
Le .NET Framework ne prend pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.
