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 ref class GacInstalled sealed : IIdentityPermissionFactory
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public final class GacInstalled implements IIdentityPermissionFactory
SerializableAttribute 
ComVisibleAttribute(true) 
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 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() );
}

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)
            (myGacInstalled.CreateIdentityPermission(myEvidence)));
        Console.WriteLine(myPerm.ToXml().ToString());

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

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

        Console.WriteLine(myGacInstalled.ToString());
    } //main  
} //GacDemo

System.Object
  System.Security.Policy.GacInstalled

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

Community Additions

ADD
Show: