String Comparisons
Using string.Equals() method
string.Equals() methodif (string.Equals(first, second))
{
Console.WriteLine("Equal");
}
else
{
Console.WriteLine("Not equal");
}Alternatively, using '==' operator
string first = "ABC";
string second = "ABc";
if (first == second)
{
Console.WriteLine("Equal");
}
else
{
Console.WriteLine("Not equal");
}The above is NOT recommended
Last updated