تخطَّ إلى المحتوى

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.

if (email.ToLower() == other.ToLower())
Merge();
if (string.Equals(email, other, StringComparison.OrdinalIgnoreCase))
Merge();