Bagikan melalui


GacInstalled Kelas

Definisi

Perhatian

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

Mengonfirmasi bahwa rakitan kode berasal dari cache perakitan global (GAC) sebagai bukti untuk evaluasi kebijakan. Kelas ini tidak dapat diwariskan.

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
Warisan
GacInstalled
Warisan
GacInstalled
Atribut
Penerapan

Contoh

Contoh kode berikut menunjukkan penggunaan GacInstalled kelas .

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

Keterangan

Perhatian

Keamanan Akses Kode (CAS) tidak digunakan lagi di semua versi .NET Framework dan .NET. Versi terbaru .NET tidak mematuhi anotasi CAS dan menghasilkan kesalahan jika API terkait CAS digunakan. Pengembang harus mencari cara alternatif untuk menyelesaikan tugas keamanan.

Kehadiran GacInstalled bukti menghasilkan GacIdentityPermission dalam set hibah. Jika ada Demand untuk GacIdentityPermission, GacIdentityPermission yang sesuai dengan GacInstalled bukti dibandingkan dengan izin yang diminta.

Konstruktor

GacInstalled()
Kedaluwarsa.

Menginisialisasi instans baru kelas GacInstalled.

Metode

Clone()
Kedaluwarsa.

Membuat objek baru yang merupakan salinan instans saat ini.

Clone()
Kedaluwarsa.

Membuat objek baru yang merupakan salinan lengkap instans saat ini.

(Diperoleh dari EvidenceBase)
Copy()
Kedaluwarsa.

Membuat salinan yang setara dari objek saat ini.

CreateIdentityPermission(Evidence)
Kedaluwarsa.

Membuat izin identitas baru yang sesuai dengan objek saat ini.

Equals(Object)
Kedaluwarsa.

Menunjukkan apakah objek saat ini setara dengan objek yang ditentukan.

GetHashCode()
Kedaluwarsa.

Mengembalikan kode hash untuk objek saat ini.

GetType()
Kedaluwarsa.

Mendapatkan instans Type saat ini.

(Diperoleh dari Object)
MemberwiseClone()
Kedaluwarsa.

Membuat salinan dangkal dari yang saat ini Object.

(Diperoleh dari Object)
ToString()
Kedaluwarsa.

Mengembalikan representasi string dari objek saat ini.

Berlaku untuk