Compare two string values

string is a reference type. However C# uses the == to check the equality between two strings.


using System;

class Program
{
    static void Main(string[] args)
    {
        string s1 = "java2s.com";
        string s2 = "Java2s.com";
        Console.WriteLine(s1.ToUpper() == s2.ToUpper());


    }
}

The output:


True
java2s.com  |  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.