dcsimg
 

Submitted by: Srinath M S(srinath_ms@yahoo.com)

Tuesday Oct 16th 2018 by Srinath M S

Language: .NET, Expertise: Intermediate - Avoid additional overhead by using OrdinalIgnoreCase to compare strings.

We often do String.ToUpper() on two strings to compare them. This introduces additional overhead on string allocation. It is better to use OrdinalIgnoreCase instead, as shown below:

bool CompareResult = firstString.Equals(secondString, StringComparison.OrdinalIgnoreCase);
Home
Mobile Site | Full Site