CharacterRange.Equals Method

Definition

Overloads

Equals(CharacterRange)

Indicates whether the current instance is equal to another instance of the same type.

Equals(Object)

Gets a value indicating whether this object is equivalent to the specified object.

Equals(CharacterRange)

Source:
CharacterRange.cs
Source:
CharacterRange.cs
Source:
CharacterRange.cs
Source:
CharacterRange.cs

Indicates whether the current instance is equal to another instance of the same type.

public:
 virtual bool Equals(System::Drawing::CharacterRange other);
public bool Equals (System.Drawing.CharacterRange other);
public readonly bool Equals (System.Drawing.CharacterRange other);
override this.Equals : System.Drawing.CharacterRange -> bool
Public Function Equals (other As CharacterRange) As Boolean

Parameters

other
CharacterRange

An instance to compare with this instance.

Returns

true if the current instance is equal to the other instance; otherwise, false.

Implements

Applies to

Equals(Object)

Source:
CharacterRange.cs
Source:
CharacterRange.cs
Source:
CharacterRange.cs
Source:
CharacterRange.cs

Gets a value indicating whether this object is equivalent to the specified object.

public:
 override bool Equals(System::Object ^ obj);
public override bool Equals (object obj);
public override bool Equals (object? obj);
public override readonly bool Equals (object? obj);
override this.Equals : obj -> bool
Public Overrides Function Equals (obj As Object) As Boolean

Parameters

obj
Object

The object to compare to for equality.

Returns

true to indicate the specified object is an instance with the same First and Length value as this instance; otherwise, false.

Examples

The following example demonstrates how to use the Equals method. To run this example, paste it into a Windows Form. Handle the form's Paint event and call the CharacterRangeEquality2 method from the Paint event-handling method, passing e as PaintEventArgs.

private void CharacterRangeEquality2()
{

    // 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.Equals(range2))
        MessageBox.Show("The ranges are equal.");
    else
        MessageBox.Show("The ranges are not equal.");
}
Private Sub CharacterRangeEquality2() 
    
    ' 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.Equals(range2) Then
        MessageBox.Show("The ranges are equal.")
    Else
        MessageBox.Show("The ranges are not equal.")
    End If
 
End Sub

Remarks

You can also use Equality to test for equality.

Applies to