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);