Compartir a través de


CharacterRange.Inequality(CharacterRange, CharacterRange) Operador

Definición

Compara dos objetos CharacterRange. Obtiene un valor que indica si los valores de First y de Length de los dos objetos CharacterRange no son iguales.

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

Parámetros

cr1
CharacterRange

CharacterRange cuya desigualdad se va a comparar.

cr2
CharacterRange

CharacterRange cuya desigualdad se va a comparar.

Devoluciones

Es true para indicar que los valores de First o de Length de los dos objetos CharacterRange difieren; de lo contrario, es false.

Ejemplos

En el siguiente ejemplo se muestra cómo se utiliza el método Inequality. Para ejecutar este ejemplo, péguelo en un formulario Windows Forms. Controle el evento del Paint formulario y llame al CharacterRangeInequality método desde el Paint método de control de eventos, pasando e como 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

Comentarios

El Inequality método devuelve lo contrario al Equality método .

El método equivalente para este operador es CharacterRange.Equals(Object)

Se aplica a

Consulte también