ApplicationId.PublicKeyToken 属性

定义

获取应用程序的公钥标记。

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[]

一个包含应用程序的公钥标记的字节数组。

示例

下面的代码示例显示 属性,PublicKeyToken方法是从ApplicationSecurityInfo使用 为ActivationContext当前执行的基于清单的应用程序创建的 实例中获取 ApplicationId 。 此代码示例是为 ApplicationId 类提供的一个更大示例的一部分。

// 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.
printf "ApplicationId.PublicKeyToken property = "
let pk = asi.ApplicationId.PublicKeyToken
for i = 0 to pk.GetLength 0 - 1 do
    printf $"{pk[i]:x}"
' 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 个字节表示。

有关详细信息,请参阅 AssemblyName.GetPublicKeyToken

适用于