Home > Code > String Operations > String comparisons using C#.NET string.compareTo

String comparisons using C#.NET string.compareTo

by Thamil   on Nov 14, 2010   Category: String Operations   |  Views: 3610    |  Points: 25   |  Gold 


class Program
{
static void Main(string[] args)
{
string strFirstString = "Sample";
string strSecString = "Simple";
if (strFirstString.CompareTo(strSecString)==0)
{
Console.WriteLine("Both strings are same");
}
else
{
Console.WriteLine("Both strings are not same");
}
Console.ReadKey();

}
}





Post Code  |  Code Snippet Home

User Responses


No response found, be the first to review this code snippet.

Submit feedback about this code snippet

Please sign in to post feedback

Latest Posts