Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
void Main()
{
string firstEffectName = "Shot";
string secondEffectName = "Boom";
var sw = System.Diagnostics.Stopwatch.StartNew();
for(int i = 0; i< 1000000; i++)
{
var a = string.Compare(firstEffectName, secondEffectName, StringComparison.InvariantCultureIgnoreCase) == 0;
}
sw.Stop();
Console.WriteLine("InvariantCultureIgnoreCase: {0}ms",sw.ElapsedMilliseconds);
sw.Restart();
for(int i = 0; i< 1000000; i++)
{
var a = string.Compare(firstEffectName, secondEffectName, StringComparison.OrdinalIgnoreCase) == 0;
}
sw.Stop();
Console.WriteLine("OrdinalIgnoreCase: {0}ms",sw.ElapsedMilliseconds);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment