CharacterRange.Equality(CharacterRange, CharacterRange) 연산자

정의

두 개의 CharacterRange 개체를 비교합니다. 두 First 개체의 LengthCharacterRange 값이 같은지 여부를 나타내는 값을 가져옵니다.

public:
 static bool operator ==(System::Drawing::CharacterRange cr1, System::Drawing::CharacterRange cr2);
public static bool operator == (System.Drawing.CharacterRange cr1, System.Drawing.CharacterRange cr2);
static member ( = ) : System.Drawing.CharacterRange * System.Drawing.CharacterRange -> bool
Public Shared Operator == (cr1 As CharacterRange, cr2 As CharacterRange) As Boolean

매개 변수

cr1
CharacterRange

같은지 여부를 비교할 CharacterRange입니다.

cr2
CharacterRange

같은지 여부를 비교할 CharacterRange입니다.

반환

CharacterRange 개체의 FirstLength 값이 같으면 true이고 그렇지 않으면 false입니다.

예제

다음 예제에서는 연산자를 사용하는 방법을 보여 줍니다 Equality . 이 예제를 실행 하려면 Windows 폼에 붙여 넣습니다. 양식의 처리 Paint 이벤트 및 호출 합니다 CharacterRangeEquality1 메서드에서 Paint 전달 하는 이벤트 처리 메서드를 e 으로 PaintEventArgs입니다.

private void CharacterRangeEquality1()
{

    // Declare the string to draw.
    string message = "Strings or strings; that is the question.";

    // Compare the ranges for equality. The should not be equal.
    CharacterRange range1 = 
        new CharacterRange(message.IndexOf("Strings"), "Strings".Length);
    CharacterRange range2 = 
        new CharacterRange(message.IndexOf("strings"), "strings".Length);

    if (range1 == range2)
        MessageBox.Show("The ranges are equal.");
    else
        MessageBox.Show("The ranges are not equal.");
}
Private Sub CharacterRangeEquality1() 
    
    ' Declare the string to draw.
    Dim message As String = "Strings or strings; that is the question."
    
    ' Compare the ranges for equality. The should not be equal.
    Dim range1 As New CharacterRange(message.IndexOf("Strings"), _
        "Strings".Length)
    Dim range2 As New CharacterRange(message.IndexOf("strings"), _
        "strings".Length)
    
    If range1 = range2 Then
        MessageBox.Show("The ranges are equal.")
    Else
        MessageBox.Show("The ranges are not equal.")
    End If
 
End Sub

설명

메서드를 사용하여 같음을 테스트할 Equals 수도 있습니다.

이 연산자에 대 한 해당 메서드는 CharacterRange.Equals(Object)

적용 대상