CryptographicBuffer.Compare(IBuffer, IBuffer) 메서드

정의

두 개의 IBuffer 개체를 비교합니다.

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

비교에 사용할 버퍼입니다.

object2
IBuffer

비교에 사용할 버퍼입니다.

반환

Boolean

bool

True 는 버퍼가 같게 지정합니다. 하나의 각 코드 지점이 다른 코드 포인트와 일치하는 경우 두 개의 버퍼가 동일합니다.

예제


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);
}

적용 대상