GacInstalled 类

定义

注意

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

确认一个代码程序集在全局程序集缓存 (GAC) 中以策略评估证据的形式产生。 此类不能被继承。

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
继承
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 中弃用。 如果使用与 CAS 相关的 API,最新版本的 .NET 不会遵循 CAS 注释,并会生成错误。 开发人员应寻求用于完成安全任务的替代方法。

证据的存在 GacInstalled 在授权集中生成 GacIdentityPermission 。 如果 存在 DemandGacIdentityPermissionGacIdentityPermission则与GacInstalled证据相对应的 将与所需权限进行比较。

构造函数

GacInstalled()
已过时.

初始化 GacInstalled 类的新实例。

方法

Clone()
已过时.

创建作为当前实例副本的新对象。

Clone()
已过时.

创建作为当前实例的完整副本的新对象。

(继承自 EvidenceBase)
Copy()
已过时.

创建当前对象的等效副本。

CreateIdentityPermission(Evidence)
已过时.

创建与当前对象对应的新标识权限。

Equals(Object)
已过时.

指示当前对象是否等效于指定的对象。

GetHashCode()
已过时.

返回当前对象的哈希代码。

GetType()
已过时.

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()
已过时.

创建当前 Object 的浅表副本。

(继承自 Object)
ToString()
已过时.

返回当前对象的字符串表示形式。

适用于