GacInstalled Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Caution
Code Access Security is not supported or honored by the runtime.
Confirms that a code assembly originates in the global assembly cache (GAC) as evidence for policy evaluation. This class cannot be inherited.
public ref class GacInstalled sealed : System::Security::Policy::EvidenceBase, System::Security::Policy::IIdentityPermissionFactory
public ref class GacInstalled sealed : System::Security::Policy::IIdentityPermissionFactory
[System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public sealed class GacInstalled : System.Security.Policy.EvidenceBase, System.Security.Policy.IIdentityPermissionFactory
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public sealed class GacInstalled : System.Security.Policy.IIdentityPermissionFactory
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public sealed class GacInstalled : System.Security.Policy.EvidenceBase, System.Security.Policy.IIdentityPermissionFactory
public sealed class GacInstalled : System.Security.Policy.EvidenceBase, System.Security.Policy.IIdentityPermissionFactory
[<System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type GacInstalled = class
inherit EvidenceBase
interface IIdentityPermissionFactory
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type GacInstalled = class
interface IIdentityPermissionFactory
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type GacInstalled = class
inherit EvidenceBase
interface IIdentityPermissionFactory
type GacInstalled = class
inherit EvidenceBase
interface IIdentityPermissionFactory
Public NotInheritable Class GacInstalled
Inherits EvidenceBase
Implements IIdentityPermissionFactory
Public NotInheritable Class GacInstalled
Implements IIdentityPermissionFactory
- Inheritance
- Inheritance
-
GacInstalled
- Attributes
- Implements
Examples
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() );
}
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());
}
}
}
Imports System.Security.Policy
Imports System.Security
Imports System.Security.Permissions
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
End Class
Remarks
Caution
Code Access Security (CAS) has been deprecated across all versions of .NET Framework and .NET. Recent versions of .NET do not honor CAS annotations and produce errors if CAS-related APIs are used. Developers should seek alternative means of accomplishing security tasks.
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.
Constructors
GacInstalled() |
Initializes a new instance of the GacInstalled class. |
Methods
Clone() |
Creates a new object that is a copy of the current instance. |
Clone() |
Creates a new object that is a complete copy of the current instance. (Inherited from EvidenceBase) |
Copy() |
Creates an equivalent copy of the current object. |
CreateIdentityPermission(Evidence) |
Creates a new identity permission that corresponds to the current object. |
Equals(Object) |
Indicates whether the current object is equivalent to the specified object. |
GetHashCode() |
Returns a hash code for the current object. |
GetType() |
Gets the Type of the current instance. (Inherited from Object) |
MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
ToString() |
Returns a string representation of the current object. |