このコード例では、WinUI アプリで base64 データと 16 進数データをエンコードおよびデコードする方法を示します。
public void EncodeDecodeBase64()
{
// Define a Base64 encoded string.
String strBase64 = "uiwyeroiugfyqcajkds897945234==";
// Decoded the string from Base64 to binary.
IBuffer buffer = CryptographicBuffer.DecodeFromBase64String(strBase64);
// Encode the buffer back into a Base64 string.
String strBase64New = CryptographicBuffer.EncodeToBase64String(buffer);
}
public void EncodeDecodeHex()
{
// Define a hexadecimal string.
String strHex = "30310AFF";
// Decode a hexadecimal string to binary.
IBuffer buffer = CryptographicBuffer.DecodeFromHexString(strHex);
// Encode the buffer back into a hexadecimal string.
String strHexNew = CryptographicBuffer.EncodeToHexString(buffer);
}
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
Windows developer