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)

public sealed class GacInstalled : IIdentityPermissionFactory
/** @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.

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());


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