Comparing strings in C#

We can compare the strings by a simple if condition.
Remember to use 'Equals' instead of '=' or '= =' for comparing strings.

using System;
using System.IO;
using System.Text;

namespace forgetCode
{
    class program1
    {
        static void Main(string[] args)
        {
            string firstString = "Forget code";
            string secondString = "Forget code";

            if (firstString.Equals(secondString))
            {
                Console.WriteLine("Strings are same");
            }
            else
            {
                Console.WriteLine("Strings are not same"); 
            }
            
        }
   
    }
}


Output:
Strings are same

..

using System;
using System.IO;
using System.Text;

namespace forgetCode
{
    class program1
    {
        static void Main(string[] args)
        {
            string firstString = "Forget code";
            string secondString = "Forget";

            if (firstString.Equals(secondString))
            {
                Console.WriteLine("Strings are same");
            }
            else
            {
                Console.WriteLine("Strings are not same"); 
            }
            
        }
   
    }
}


Output:
Strings are not same

..