CharacterRange.Inequality(CharacterRange, CharacterRange) CharacterRange.Inequality(CharacterRange, CharacterRange) CharacterRange.Inequality(CharacterRange, CharacterRange) CharacterRange.Inequality(CharacterRange, CharacterRange) Operator

Définition

Compare deux objets CharacterRange.Compares two CharacterRange objects. Obtient une valeur indiquant que les valeurs First ou Length des deux objets CharacterRange ne sont pas égales.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

Paramètres

cr1
CharacterRange CharacterRange CharacterRange CharacterRange

CharacterRange à comparer en termes d'inégalité.A CharacterRange to compare for inequality.

cr2
CharacterRange CharacterRange CharacterRange CharacterRange

CharacterRange à comparer en termes d'inégalité.A CharacterRange to compare for inequality.

Retours

true pour indiquer que la valeur First ou la valeur Length des deux objets CharacterRange diffère ; sinon, false.true to indicate the either the First or Length values of the two CharacterRange objects differ; otherwise, false.

Exemples

L'exemple suivant décrit comment utiliser la méthode Inequality.The following example demonstrates how to use the Inequality method. Pour exécuter cet exemple, collez-le dans un formulaire Windows.To run this example, paste it into a Windows Form. Gérer le formulaire Paint événements et les appels le CharacterRangeInequality méthode à partir de la Paint méthode de gestion des événements, en passant e comme 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

Remarques

Le Inequality méthode retourne l’inverse de la Equality (méthode).The Inequality method returns the opposite of the Equality method.

La méthode équivalente pour cet opérateur est CharacterRange.Equals(Object)The equivalent method for this operator is CharacterRange.Equals(Object)

S’applique à

Voir aussi