Case-insensitive comparison through ToLower/ToUpper (CA1862)
هذا المحتوى غير متوفر بلغتك بعد.
Key dotnet.performance.case-insensitive-compare · Severity warning · Category performance
Microsoft analyzer CA1862. Flags ToLower/ToUpper used to compare strings case-insensitively. Each call allocates a new string; the StringComparison overloads compare in place.
Incorrect
Section titled “Incorrect”if (email.ToLower() == other.ToLower()) Merge();Correct
Section titled “Correct”if (string.Equals(email, other, StringComparison.OrdinalIgnoreCase)) Merge();