NullableTypes Class Library

NullableString.Compare Method (NullableString, NullableString, Boolean, CultureInfo)

Compares two specified NullableString structures, ignoring or honoring their case and honoring culture-specific information about their formatting.

[Visual Basic]
Overloads Public Shared Function Compare( _
   ByVal a As NullableString, _
   ByVal b As NullableString, _
   ByVal ignoreCase As Boolean, _
   ByVal culture As CultureInfo _
) As Integer
[C#]
public static int Compare(
   NullableString a,
   NullableString b,
   bool ignoreCase,
   CultureInfo culture
);

Parameters

a
A NullableString structure.
b
A NullableString structure.
ignoreCase
A Boolean indicating a case-sensitive or insensitive comparison. (true indicates a case-insensitive comparison).
culture
A CultureInfo object that supplies culture-specific formatting information.

Return Value

A 32-bit signed integer indicating the lexical relationship between the two comparands.

ValueDescription
A negative integera is less than b.
Zeroa is equal to b.
A positive integera is greater than b.

-or-

b is Null.

Remarks

culture specifies a CultureInfo object, which provides culture-specific information that can affect the comparison. By definition, any NullableString, including the Empty string, compares greater than a Null; and two Null compare equal to each other.

Exceptions

Exception TypeCondition
ArgumentNullExceptionculture is a null reference (Nothing in Visual Basic).

See Also

NullableString Class | NullableTypes Namespace | NullableString.Compare Overload List