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)

System.Object
  System.Security.Policy.EvidenceBase
    System.Security.Policy.GacInstalled

[SerializableAttribute]
[ComVisibleAttribute(true)]
public sealed class GacInstalled : EvidenceBase, IIdentityPermissionFactory

NameDescription
System_CAPS_pubmethodGacInstalled()

Initializes a new instance of the GacInstalled class.

NameDescription
System_CAPS_pubmethodClone()

Creates a new object that is a copy of the current instance.(Overrides EvidenceBase.Clone().)

System_CAPS_pubmethodCopy()

Creates an equivalent copy of the current object.

System_CAPS_pubmethodCreateIdentityPermission(Evidence)

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

System_CAPS_pubmethodEquals(Object)

Indicates whether the current object is equivalent to the specified object.(Overrides Object.Equals(Object).)

System_CAPS_pubmethodGetHashCode()

Returns a hash code for the current object.(Overrides Object.GetHashCode().)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string representation of the current object.(Overrides Object.ToString().)

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

.NET Framework
Available since 2.0

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

Return to top
Show: