Bagikan melalui


GacInstalled.CreateIdentityPermission(Evidence) Metode

Definisi

Membuat izin identitas baru yang sesuai dengan objek saat ini.

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

Parameter

evidence
Evidence

Evidence dari mana untuk membangun izin identitas.

Mengembalikan

Izin identitas baru yang sesuai dengan objek saat ini.

Penerapan

Contoh

Contoh kode berikut menunjukkan penggunaan CreateIdentityPermission metode . Contoh ini adalah bagian dari contoh yang lebih besar yang disediakan untuk GacInstalled kelas .

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

Keterangan

GacIdentityPermission dapat digunakan untuk menentukan apakah kode panggilan berada dalam cache perakitan global.

Berlaku untuk