Share via


Equality Operator

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Determines whether two specified strings have the same value.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Shared Operator = ( _
    a As String, _
    b As String _
) As Boolean
public static bool operator ==(
    string a,
    string b
)
public:
static bool operator ==(
    String^ a, 
    String^ b
)
static let inline (=)
        a:string * 
        b:string  : bool
JScript does not support overloaded operators.

Parameters

  • a
    Type: System. . :: . .String
    The first string to compare, or nullNothingnullptrunita null reference (Nothing in Visual Basic).
  • b
    Type: System. . :: . .String
    The second string to compare, or nullNothingnullptrunita null reference (Nothing in Visual Basic).

Return Value

Type: System. . :: . .Boolean
true if the value of a is the same as the value of b; otherwise, false.

Remarks

The Equality method defines the operation of the equality operator for the String class.

This operator is implemented using the Equals method, which means the comparands are tested for a combination of reference and value equality. This operator performs an ordinal comparison.

.NET Framework Security

See Also

Reference

String Class

System Namespace