GacInstalled.CreateIdentityPermission(Evidence) Method

Definition

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

public:
 virtual System::Security::IPermission ^ CreateIdentityPermission(System::Security::Policy::Evidence ^ evidence);
public System.Security.IPermission CreateIdentityPermission (System.Security.Policy.Evidence evidence);
abstract member CreateIdentityPermission : System.Security.Policy.Evidence -> System.Security.IPermission
override this.CreateIdentityPermission : System.Security.Policy.Evidence -> System.Security.IPermission
Public Function CreateIdentityPermission (evidence As Evidence) As IPermission

Parameters

evidence
Evidence

The Evidence from which to construct the identity permission.

Returns

A new identity permission that corresponds to the current object.

Implements

Examples

The following code example shows the use of the CreateIdentityPermission method. This example is part of a larger example provided for the GacInstalled class.

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() );
Object [] hostEvidence = {myGacInstalled};
Object [] assemblyEvidence = {};
Evidence myEvidence = new Evidence(hostEvidence,assemblyEvidence);
GacIdentityPermission myPerm = 
    (GacIdentityPermission)myGacInstalled.CreateIdentityPermission(
    myEvidence);
Console.WriteLine(myPerm.ToXml().ToString());
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())

Remarks

The GacIdentityPermission can be used to determine whether the calling code is in the global assembly cache.

Applies to