Home > Code > C# > Ignore the case while comparing two strings in C#

Ignore the case while comparing two strings in C#

by Thamil   on May 28, 2013   Category: C#   |  Views: 863    |  Points: 25   |  Gold 


Below is the best way to compare the string in C# and ignore the case sensitive.

string strCompare = "testcomPARE";

if (strCompare.Equals("testcompare", StringComparison.InvariantCultureIgnoreCase))
{
///
}



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