ApplicationId.PublicKeyToken Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan token kunci publik untuk aplikasi.
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()
Nilai Properti
Array byte yang berisi token kunci publik untuk aplikasi.
Contoh
Contoh kode berikut menampilkan PublicKeyToken properti dengan mendapatkan ApplicationId dari instans yang dibuat menggunakan ActivationContext untuk aplikasi berbasis manifes yang ApplicationSecurityInfo sedang dijalankan. Contoh kode ini adalah bagian dari contoh yang lebih besar yang disediakan untuk ApplicationId kelas .
// 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
Keterangan
Token kunci publik diwakili oleh 8 byte terakhir dari hash SHA-1 dari kunci publik tempat aplikasi ditandatangani.
Untuk informasi selengkapnya, lihat AssemblyName.GetPublicKeyToken .