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 NotInheritable Class GacInstalled
	Inherits EvidenceBase
	Implements 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.

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), _ 
            GacIdentityPermission)
        Console.WriteLine(myPerm.ToXml().ToString())

        Dim myGacInstalledCopy As GacInstalled = _
            CType(myGacInstalled.Copy(), GacInstalled)
        Dim result As Boolean = myGacInstalled.Equals(myGacInstalledCopy)

        Console.WriteLine( _
            ("Hashcode = " & myGacInstalled.GetHashCode().ToString()))

        Console.WriteLine(myGacInstalled.ToString())
    End Sub 'Main 
End Class 'GacDemo

.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: