共用方式為


GacInstalled.CreateIdentityPermission(Evidence) 方法

定義

建立對應至目前物件的新識別權限。

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

參數

evidence
Evidence

要建構識別使用權限的來源 Evidence

傳回

對應至目前物件的新識別權限。

實作

範例

下列程式代碼範例示範 如何使用 CreateIdentityPermission 方法。 這個範例是提供給 類別之較大範例的 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() );
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())

備註

GacIdentityPermission可用來判斷呼叫程式代碼是否位於全域程式集緩存中。

適用於