共用方式為


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

位元組陣列,包含應用程式的公開金鑰語彙基元。

範例

下列程式碼範例會從 ApplicationSecurityInfo 使用 ActivationContext 目前執行之資訊清單型應用程式的 所建立的 實例取得 來顯示 PublicKeyTokenApplicationId 屬性。 此程式碼範例是針對 類別提供的較大範例的 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

適用於