Comparing strings in C#

Comparing strings in C#


using System;

public class Program
{
    public static void Main()
    {
        Console.WriteLine("Comparing strings in C#\n");
        string firstString = "Lorem Ipsum is simply dummy text";
        string secondString = "Lorem Ipsum is simply dummy text.";
        if (firstString.Equals(secondString))
        {
            Console.WriteLine("Strings are same");
        }
        else
        {
            Console.WriteLine("Strings are not same");
        }
    }
}
DEMO
Comparing strings in C# Comparing strings in C# Reviewed by Bhaumik Patel on 8:32 PM Rating: 5