Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

GacInstalled Class

Note: This class is new in the .NET Framework version 2.0.

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

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
    {
        [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());
        }
    }
}

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 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.