Exportar (0) Imprimir
Expandir todo

AppDomain.Id (Propiedad)

Obtiene un entero que identifica únicamente el dominio de aplicación en el proceso.

Espacio de nombres: System
Ensamblado: mscorlib (en mscorlib.dll)

public int Id { get; }
/** @property */
public int get_Id ()

public function get Id () : int

No aplicable.

Valor de propiedad

Entero que identifica el dominio de aplicación.

En el ejemplo de código siguiente se crea un segundo dominio de aplicación y se muestra la información sobre el dominio predeterminado y el nuevo dominio.

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());
    }
}

import System.*;
import 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.
    /** @attribute LoaderOptimizationAttribute(
        LoaderOptimization.MultiDomainHost)
     */
    public static void main(String[] args)
    {
        // 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));
    } //main

    // 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.get_CurrentDomain();
        Console.WriteLine();
        Console.WriteLine("FriendlyName: {0}", ad.get_FriendlyName());
        Console.WriteLine("Id: {0}", (Int32)ad.get_Id());
        Console.WriteLine("IsDefaultAppDomain: {0}", 
            (System.Boolean)ad.IsDefaultAppDomain());
    } //ShowDomainInfo
} //Example

Windows 98, Windows 2000 Service Pack 4, Windows CE, Windows Millennium, Windows Mobile para Pocket PC, Windows Mobile para Smartphone, Windows Server 2003, Windows XP Media Center, Windows XP Professional x64, Windows XP SP2, Windows XP Starter

Microsoft .NET Framework 3.0 es compatible con Windows Vista, Microsoft Windows XP SP2 y Windows Server 2003 SP1.

.NET Framework

Compatible con: 3.0, 2.0

Adiciones de comunidad

AGREGAR
Mostrar:
© 2014 Microsoft