Compartir a través de


GacInstalled Clase

Definición

Precaución

Code Access Security is not supported or honored by the runtime.

Confirma que se ha originado un ensamblado de código en la caché global de ensamblados (GAC) como prueba para la evaluación de directivas. Esta clase no puede heredarse.

public ref class GacInstalled sealed : System::Security::Policy::EvidenceBase, System::Security::Policy::IIdentityPermissionFactory
public ref class GacInstalled sealed : System::Security::Policy::IIdentityPermissionFactory
[System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public sealed class GacInstalled : System.Security.Policy.EvidenceBase, System.Security.Policy.IIdentityPermissionFactory
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public sealed class GacInstalled : System.Security.Policy.IIdentityPermissionFactory
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public sealed class GacInstalled : System.Security.Policy.EvidenceBase, System.Security.Policy.IIdentityPermissionFactory
public sealed class GacInstalled : System.Security.Policy.EvidenceBase, System.Security.Policy.IIdentityPermissionFactory
[<System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type GacInstalled = class
    inherit EvidenceBase
    interface IIdentityPermissionFactory
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type GacInstalled = class
    interface IIdentityPermissionFactory
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type GacInstalled = class
    inherit EvidenceBase
    interface IIdentityPermissionFactory
type GacInstalled = class
    inherit EvidenceBase
    interface IIdentityPermissionFactory
Public NotInheritable Class GacInstalled
Inherits EvidenceBase
Implements IIdentityPermissionFactory
Public NotInheritable Class GacInstalled
Implements IIdentityPermissionFactory
Herencia
GacInstalled
Herencia
GacInstalled
Atributos
Implementaciones

Ejemplos

En el ejemplo de código siguiente se muestra el uso de la GacInstalled clase .

using namespace System;
using namespace System::Security::Policy;
using namespace System::Security;
using namespace System::Security::Permissions;

[STAThread]
int main()
{

    GacInstalled ^ myGacInstalled = gcnew GacInstalled;

    array<Object^>^hostEvidence = {myGacInstalled};
    array<Object^>^assemblyEvidence = {};
    Evidence^ myEvidence = gcnew Evidence( hostEvidence,assemblyEvidence );
    GacIdentityPermission ^ myPerm = dynamic_cast<GacIdentityPermission^>
        (myGacInstalled->CreateIdentityPermission( myEvidence ));
    Console::WriteLine( myPerm->ToXml() );

    GacInstalled ^ myGacInstalledCopy = 
        dynamic_cast<GacInstalled^>(myGacInstalled->Copy());
    bool result = myGacInstalled->Equals( myGacInstalledCopy );

    Console::WriteLine( "Hashcode = {0}", myGacInstalled->GetHashCode() );

    Console::WriteLine( myGacInstalled->ToString() );
}
using System;
using System.Security.Policy;
using System.Security;
using System.Security.Permissions;

namespace GacClass
{
    class GacDemo
    {
        [STAThread]
        static void Main(string[] args)
        {
            GacInstalled myGacInstalled = new GacInstalled();

            Object [] hostEvidence = {myGacInstalled};
            Object [] assemblyEvidence = {};
            Evidence myEvidence = new Evidence(hostEvidence,assemblyEvidence);
            GacIdentityPermission myPerm = 
                (GacIdentityPermission)myGacInstalled.CreateIdentityPermission(
                myEvidence);
            Console.WriteLine(myPerm.ToXml().ToString());

            GacInstalled myGacInstalledCopy = 
                (GacInstalled)myGacInstalled.Copy();
            bool result = myGacInstalled.Equals(myGacInstalledCopy);

            Console.WriteLine(
                "Hashcode = " + myGacInstalled.GetHashCode().ToString());

            Console.WriteLine(myGacInstalled.ToString());
        }
    }
}
Imports System.Security.Policy
Imports System.Security
Imports System.Security.Permissions

Class GacDemo
    <STAThread()> _
    Overloads Shared Sub Main(ByVal args() As String)
        Dim myGacInstalled As New GacInstalled

        Dim hostEvidence() As Object = {myGacInstalled}
        Dim assemblyEvidence() As Object
        Dim myEvidence As New Evidence(hostEvidence, assemblyEvidence)
        Dim myPerm As GacIdentityPermission = _
            CType(myGacInstalled.CreateIdentityPermission(myEvidence), _ 
            GacIdentityPermission)
        Console.WriteLine(myPerm.ToXml().ToString())

        Dim myGacInstalledCopy As GacInstalled = _
            CType(myGacInstalled.Copy(), GacInstalled)
        Dim result As Boolean = myGacInstalled.Equals(myGacInstalledCopy)

        Console.WriteLine( _
            ("Hashcode = " & myGacInstalled.GetHashCode().ToString()))

        Console.WriteLine(myGacInstalled.ToString())
    End Sub
End Class

Comentarios

Precaución

La seguridad de acceso del código (CAS) ha quedado en desuso en todas las versiones de .NET Framework y .NET. Las versiones recientes de .NET no respetan las anotaciones de CAS y generan errores si se usan API relacionadas con CAS. Los desarrolladores deben buscar medios alternativos para realizar tareas de seguridad.

La presencia de GacInstalled evidencia genera un GacIdentityPermission objeto en el conjunto de concesión. Si hay para DemandGacIdentityPermission, el GacIdentityPermission que corresponde a la GacInstalled evidencia se compara con el permiso solicitado.

Constructores

GacInstalled()
Obsoletos.

Inicializa una nueva instancia de la clase GacInstalled.

Métodos

Clone()
Obsoletos.

Crea un nuevo objeto copiado de la instancia actual.

Clone()
Obsoletos.

Crea un nuevo objeto que es una copia completa de la instancia actual.

(Heredado de EvidenceBase)
Copy()
Obsoletos.

Crea una copia equivalente del objeto actual.

CreateIdentityPermission(Evidence)
Obsoletos.

Crea un nuevo permiso de identidad correspondiente al objeto actual.

Equals(Object)
Obsoletos.

Indica si el objeto actual es equivalente al objeto especificado.

GetHashCode()
Obsoletos.

Devuelve un código hash del objeto actual.

GetType()
Obsoletos.

Obtiene el Type de la instancia actual.

(Heredado de Object)
MemberwiseClone()
Obsoletos.

Crea una copia superficial del Object actual.

(Heredado de Object)
ToString()
Obsoletos.

Devuelve una representación de cadena del objeto actual.

Se aplica a