ApplicationId.PublicKeyToken 属性

定义

获取应用程序的公钥标记。Gets the public key token for the application.

public:
 property cli::array <System::Byte> ^ PublicKeyToken { cli::array <System::Byte> ^ get(); };
public byte[] PublicKeyToken { get; }
member this.PublicKeyToken : byte[]
Public ReadOnly Property PublicKeyToken As Byte()

属性值

Byte[]

一个包含应用程序的公钥标记的字节数组。A byte array containing the public key token for the application.

示例

下面的代码示例 PublicKeyToken 通过 ApplicationId ApplicationSecurityInfo 使用 ActivationContext 为当前正在执行的基于清单的应用程序创建的实例获取,来显示属性。The following code example displays the PublicKeyToken property by obtaining the ApplicationId from an ApplicationSecurityInfo instance created using the ActivationContext for the currently executing manifest-based application. 此代码示例是为类提供的更大示例的一部分 ApplicationIdThis code example is part of a larger example provided for the ApplicationId class.

// To display the value of the public key, enumerate the Byte array for the property.
Console.Write("ApplicationId.PublicKeyToken property = ");
byte[] pk = asi.ApplicationId.PublicKeyToken;
for (int i = 0; i < pk.GetLength(0); i++)
    Console.Write("{0:x}", pk[i]);
' To display the value of the public key, enumerate the Byte array for the property.
Console.Write("ApplicationId.PublicKeyToken property = ")
Dim pk As Byte() = asi.ApplicationId.PublicKeyToken
Dim i As Integer
For i = 0 To (pk.GetLength(0))
    Console.Write("{0:x}", pk(i))
Next i 

注解

公钥标记由用于对应用程序签名的公钥的 SHA-1 哈希值的最后8个字节表示。The public key token is represented by the last 8 bytes of the SHA-1 hash of the public key under which the application is signed.

有关详细信息,请参阅 AssemblyName.GetPublicKeyTokenFor more information, see AssemblyName.GetPublicKeyToken.

适用于