public static CharComparer Create([NotNull] System.StringComparer stringComparer) { if (stringComparer == null) { throw new ArgumentNullException(nameof(stringComparer)); } // Handle common equivalents. if (stringComparer.Equals(System.StringComparer.InvariantCulture)) { return(InvariantCulture); } if (stringComparer.Equals(System.StringComparer.InvariantCultureIgnoreCase)) { return(InvariantCultureIgnoreCase); } if (stringComparer.Equals(System.StringComparer.Ordinal)) { return(Ordinal); } if (stringComparer.Equals(System.StringComparer.OrdinalIgnoreCase)) { return(OrdinalIgnoreCase); } // Build a comparer based on the string comparer. return(new StringComparer(stringComparer)); }
/// <inheritdoc /> public override bool Equals(char x, char y) => _stringComparer.Equals(x.ToString(), y.ToString());
internal static bool EqualsIgnoringCase(this string value1, string value2) => DefaultComparer.Equals(value1, value2);