string.IsBeforeOrEqualTo(…)
An extension method to determine if a string comes before or is equal to another.
bool IsBeforeOrEqualTo(this string lhs, string rhs, StringComparison comparisonType)
Parameters
lhs
: The left hand side of the operation.rhs
: The right hand side of the operation.comparisonType
: An enum defining the type of comparison. (See StringComparison)
Example
string a = "A";
string b = "B";
bool result = a.IsBeforeOrEqualTo(b, StringComparison.OrdinalIgnoreCase); // true