GacInstalled Класс

Определение

Внимание!

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

Подтверждает, что сборка кода принадлежит к глобальному кэшу сборок, используемому в качестве свидетельства для оценки политики. Этот класс не наследуется.

public ref class GacInstalled sealed : System::Security::Policy::EvidenceBase, System::Security::Policy::IIdentityPermissionFactory
public ref class GacInstalled sealed : 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}")]
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
type GacInstalled = class
    inherit EvidenceBase
    interface 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
Public NotInheritable Class GacInstalled
Inherits EvidenceBase
Implements IIdentityPermissionFactory
Public NotInheritable Class GacInstalled
Implements IIdentityPermissionFactory
Наследование
GacInstalled
Наследование
GacInstalled
Атрибуты
Реализации

Примеры

В следующем примере кода показано использование GacInstalled класса.

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

Комментарии

Внимание!

Безопасность доступа к коду (CAS) устарела во всех версиях платформа .NET Framework и .NET. Последние версии .NET не учитывают заметки CAS и создают ошибки, если используются API, связанные с CAS. Разработчики должны искать альтернативные средства выполнения задач безопасности.

Наличие GacInstalled доказательств создает GacIdentityPermission в наборе грантов. При наличии аргумента Demand GacIdentityPermissionfor, соответствующий GacInstalled доказательствам, GacIdentityPermission сравнивается с требуемым разрешением.

Конструкторы

GacInstalled()

Инициализирует новый экземпляр класса GacInstalled.

Методы

Clone()

Создает новый объект, являющийся копией текущего экземпляра.

Clone()

Создает новый объект, являющийся полной копией текущего экземпляра.

(Унаследовано от EvidenceBase)
Copy()

Создает эквивалентную копию текущего объекта.

CreateIdentityPermission(Evidence)

Создает новое разрешение идентификации, соответствующее текущему объекту.

Equals(Object)

Указывает, эквивалентен ли текущий объект заданному объекту.

GetHashCode()

Возвращает хэш-код для текущего объекта.

GetType()

Возвращает объект Type для текущего экземпляра.

(Унаследовано от Object)
MemberwiseClone()

Создает неполную копию текущего объекта Object.

(Унаследовано от Object)
ToString()

Возвращает строковое представление текущего объекта.

Применяется к