EqualsLenient(string, string, StringComparison)

Compares two strings and returns true if they are equal. Empty strings and null values are considered equal.

public static bool EqualsLenient(string left, string other, StringComparison comparisonType)
Returns:
bool

Parameters

left string

The left-hand operand string.

other string

The string to compare with.

comparisonType StringComparison

One of the enumeration values that specifies how strings will be compared.

EqualsLenient(string, string, bool)

Compares two strings and returns true if they are equal. Empty strings and null values are considered equal.

public static bool EqualsLenient(string left, string other, bool ignoreCase = False)
Returns:
bool

Parameters

left string

The left-hand operand string.

other string

The string to compare with.

ignoreCase bool

If true, will perform a case-insensitive ordinal comparison.

In this article