String Equality Operators- Equals Method C# with Example



String Equality Operators- Equals Method C# with Example

 using System;

namespace CSharpFundamentals
{
    class StringEqualityOperatorsEqualsMethod
    {
        private static void Main(string[] args)
        {
			String msg = "C# is COOL too";
            Console.WriteLine("Both Strings are Equal: {0}", msg == "C# is COOL too");
            Console.WriteLine("Both Strings are Equal: {0}", msg == "C# is Cool too");
			
			Console.WriteLine("Both Strings are Equal: {0}", msg.Equals("C# is COOL too"));
			Console.WriteLine("Both Strings are Equal: {0}", msg.Equals("C# is Cool too"));			
		}
    }
}
 

0 Comment's

Comment Form