CryptographicBuffer.Compare(IBuffer, IBuffer) Méthode
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
public:
static bool Compare(IBuffer ^ object1, IBuffer ^ object2);
static bool Compare(IBuffer const& object1, IBuffer const& object2);
public static bool Compare(IBuffer object1, IBuffer object2);
function compare(object1, object2)
Public Shared Function Compare (object1 As IBuffer, object2 As IBuffer) As Boolean
- object1
- IBuffer
Mémoire tampon à utiliser pour la comparaison.
- object2
- IBuffer
Mémoire tampon à utiliser pour la comparaison.
bool
True spécifie que les mémoires tampons sont égales. Deux mémoires tampons sont égales si chaque point de code dans l’un correspond au point de code correspondant dans l’autre.
public void CompareBuffers()
{
// Create a hexadecimal string.
String strHex = "30310aff";
// Create a Base64 string that is equivalent to strHex.
String strBase64v1 = "MDEK/w==";
// Create a Base64 string that is not equivalent to strHex.
String strBase64v2 = "KEDM/w==";
// Decode strHex to a buffer.
IBuffer buff1 = CryptographicBuffer.DecodeFromHexString(strHex);
// Decode strBase64v1 to a buffer.
IBuffer buff2 = CryptographicBuffer.DecodeFromBase64String(strBase64v1);
// Decode strBase64v2 to a buffer.
IBuffer buff3 = CryptographicBuffer.DecodeFromBase64String(strBase64v2);
// Compare the hexadecimal-decoded buff1 to the Base64-decoded buff2.
// The code points in the two buffers are equal, and the Boolean value
// is true.
Boolean bVal_1 = CryptographicBuffer.Compare(buff1, buff2);
// Compare the hexadecimal-decoded buff1 to the Base64-decoded buff3.
// The code points in the two buffers are not equal, and the Boolean value
// is false.
Boolean bVal_2 = CryptographicBuffer.Compare(buff1, buff3);
}
Produit | Versions |
---|---|
WinRT | Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100 |