GacInstalled GacInstalled GacInstalled GacInstalled Class


Confirms that a code assembly originates in the global assembly cache (GAC) as evidence for policy evaluation. This class cannot be inherited.

public ref class GacInstalled sealed : System::Security::Policy::EvidenceBase, System::Security::Policy::IIdentityPermissionFactory
public sealed class GacInstalled : System.Security.Policy.EvidenceBase, System.Security.Policy.IIdentityPermissionFactory
type GacInstalled = class
    inherit EvidenceBase
    interface IIdentityPermissionFactory
Public NotInheritable Class GacInstalled
Inherits EvidenceBase
Implements IIdentityPermissionFactory


The following code example shows the use of the GacInstalled class.

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

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 = 
    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
        static void Main(string[] args)
            GacInstalled myGacInstalled = new GacInstalled();

            Object [] hostEvidence = {myGacInstalled};
            Object [] assemblyEvidence = {};
            Evidence myEvidence = new Evidence(hostEvidence,assemblyEvidence);
            GacIdentityPermission myPerm = 

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

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

Imports System
Imports System.Security.Policy
Imports System.Security
Imports System.Security.Permissions
Imports Microsoft.VisualBasic

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), _ 

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

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

    End Sub 'Main 
End Class 'GacDemo


The presence of GacInstalled evidence produces a GacIdentityPermission in the grant set. If there is a Demand for GacIdentityPermission, the GacIdentityPermission that corresponds to the GacInstalled evidence is compared with the demanded permission.


GacInstalled() GacInstalled() GacInstalled() GacInstalled()

Initializes a new instance of the GacInstalled class.


Clone() Clone() Clone() Clone()

Creates a new object that is a copy of the current instance.

Copy() Copy() Copy() Copy()

Creates an equivalent copy of the current object.

CreateIdentityPermission(Evidence) CreateIdentityPermission(Evidence) CreateIdentityPermission(Evidence) CreateIdentityPermission(Evidence)

Creates a new identity permission that corresponds to the current object.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Indicates whether the current object is equivalent to the specified object.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Returns a hash code for the current object.

GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Returns a string representation of the current object.

Applies to