GacInstalled.CreateIdentityPermission(Evidence) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
创建与当前对象对应的新标识权限。
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
参数
返回
与当前对象对应的新标识权限。
实现
示例
下面的代码示例演示如何使用 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可用于确定调用代码是否位于全局程序集缓存中。