What is the most efficient way to do the String comparison?
- by Raj Aththanayake
Hi
Both do the same thing. What is the most efficient way to compare two strings?
Equals() or Compare()? Are there any differences?
if (String.Equals(StringA, StringB, StringComparison.OrdinalIgnoreCase))
{
// Your code goes here
}
if (String.Compare(StringA, StringB, true) == 0)
{
…