C# String Equality
Description
String Equality
determines whether two specified strings
have the same value.
Syntax
String.Equality
has the following syntax.
public static bool operator ==(
string a,
string b
)
Parameters
String.Equality
has the following parameters.
a
- The first string to compare, or null.b
- The second string to compare, or null.
Returns
String.Equality
method returns true if the value of a is the same as the value of b; otherwise, false.
Example
The following example demonstrates the equality operator.
/*w w w.j av a2 s .c o m*/
using System;
class EqualityOp
{
public static void Main()
{
String Lower = "abcd";
Console.WriteLine( Lower == "abcd");
}
}
The code above generates the following result.