This documentation is archived and is not being maintained.

GacInstalled Class

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

Namespace: System.Security.Policy
Assembly: mscorlib (in mscorlib.dll)

<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public NotInheritable Class GacInstalled
	Implements IIdentityPermissionFactory
Dim instance As GacInstalled

/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public final class GacInstalled implements IIdentityPermissionFactory
public final class GacInstalled implements IIdentityPermissionFactory
Not applicable.

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.

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

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

package GacClass ; 

import System.*;
import System.Security.Policy.*;
import System.Security.*;
import System.Security.Permissions.*;

class GacDemo
    /** @attribute STAThread()
    public static void main(String[] args)
        GacInstalled myGacInstalled = new GacInstalled();

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

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

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

    } //main  
} //GacDemo


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0