CharacterRange.Inequality(CharacterRange, CharacterRange) 연산자

정의

CharacterRange 개체를 비교합니다.Compares two CharacterRange objects. First 개체의 Length 또는 CharacterRange 값이 같지 않은지 여부를 나타내는 값을 가져옵니다.Gets a value indicating whether the First or Length values of the two CharacterRange objects are not equal.

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 op_Inequality : System.Drawing.CharacterRange * System.Drawing.CharacterRange -> bool
Public Shared Operator != (cr1 As CharacterRange, cr2 As CharacterRange) As Boolean

매개 변수

cr1
CharacterRange

불일치 여부를 비교할 CharacterRange입니다.A CharacterRange to compare for inequality.

cr2
CharacterRange

불일치 여부를 비교할 CharacterRange입니다.A CharacterRange to compare for inequality.

반환

true 개체의 First 또는 Length 값이 다르면 CharacterRange이고, 그렇지 않으면 false입니다.true to indicate the either the First or Length values of the two CharacterRange objects differ; otherwise, false.

예제

다음 예제에서는 Inequality 메서드를 사용하는 방법을 보여 줍니다.The following example demonstrates how to use the Inequality method. 이 예제를 실행 하려면 Windows 폼에 붙여 넣습니다.To run this example, paste it into a Windows Form. 양식의 처리 Paint 이벤트 및 호출 합니다 CharacterRangeInequality 메서드에서 Paint 전달 하는 이벤트 처리 메서드를 e 으로 PaintEventArgs입니다.Handle the form's Paint event and call the CharacterRangeInequality method from the Paint event-handling method, passing e as PaintEventArgs.

private void CharacterRangeInequality()
{

    // 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("string"), "strings".Length);

    if (range1 != range2)
        MessageBox.Show("The ranges are not equal.");
    else
        MessageBox.Show("The ranges are equal.");
}
Private Sub CharacterRangeInequality() 
    
    ' 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("string"), "strings".Length)
    
    If range1 <> range2 Then
        MessageBox.Show("The ranges are not equal.")
    Else
        MessageBox.Show("The ranges are equal.")
    End If
End Sub

설명

Inequality 메서드는 Equality 메서드와 반대 되는을 반환 합니다.The Inequality method returns the opposite of the Equality method.

이 연산자에 대 한 해당 메서드는 CharacterRange.Equals(Object)The equivalent method for this operator is CharacterRange.Equals(Object)

적용 대상

추가 정보