String Compare Method C# with Example



String Compare Method C# with Example

 using System;

namespace CSharpFundamentals
{
    class StringCompareMethod
    {
        private static void Main(string[] args)
        {
			string name = "C# is COOL too";
			Console.WriteLine("Total Characters of the String: {0}", name.Length);
			
			Console.WriteLine("Both Strings are Equal: {0}", String.Compare(name, name));
			Console.WriteLine("Both Strings are Equal: {0}", String.Compare("D#", name));
			Console.WriteLine("Both Strings are Equal: {0}", String.Compare(name, "D#"));
		}
    }
}
 

0 Comment's

Comment Form

Submit Comment