Mega Code Archive

 
Categories / C# Book / 01 Language Basics
 

0033 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 = "rntsoft.com"; string s2 = "rntsoft.com"; Console.WriteLine(s1.ToUpper() == s2.ToUpper()); } } The output: True