C# program to check whether the two entered string are equal or not using string class and its methods also find the length of each string

Category > CSHARP || Published on : Tuesday, November 3, 2020 || Views: 44 || check whether the two entered string are equal or not using string class find the length of each string


Here Pawan Kumar will explain how to check whether the two entered string are equal or not using string class and its methods also find the length of each string

using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication10
{
    class Demo
    {
        public static void Main(string[] args)
        {
            string s = "Check";
            string t = "Check";
            if (s.Equals(t))
                Console.WriteLine("Strings are Same");
            else
                Console.WriteLine("String are Different");
            Console.WriteLine("Length of the string s is= " + s.Length);    
            Console.ReadLine();
        }
    }
}