CharacterRange.Inequality(CharacterRange, CharacterRange) Opérateur
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Compare deux objets CharacterRange. Obtient une valeur indiquant si les First valeurs des Length deux CharacterRange objets ne sont pas égales.
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
A CharacterRange comparer pour les inégalités.
- cr2
- CharacterRange
A CharacterRange comparer pour les inégalités.
Retours
truepour indiquer les valeurs ou les First valeurs des deux Length objets diffèrent ; sinon, CharacterRange.false
Exemples
L’exemple suivant montre comment utiliser la Inequality méthode. Pour exécuter cet exemple, collez-le dans un Windows Form. Gérez l’événement du Paint formulaire et appelez la CharacterRangeInequality méthode à partir de la Paint méthode de gestion des événements, en passant e en tant que 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
La Inequality méthode retourne l’inverse de la Equality méthode.
La méthode équivalente pour cet opérateur est CharacterRange.Equals(Object)