Collation.Compare MethodCollation.Compare MethodCollation::Compare Method

Compares two specified stringStringString objects under this collation.

Syntax

Public MustOverride Function Compare( _
    value1 As String, _
    value2 As String _
) As Integer
public abstract int Compare(
    string value1,
    string value2
)
public:
virtual int Compare(
    String^ value1, 
    String^ value2
) abstract
 

Parameters

value1

Type: System.StringSystem.StringSystem::String^

The first stringStringString to compare.

value2

Type: System.StringSystem.StringSystem::String^

The second stringStringString to compare.

Return Value

Type: System.Int32System.Int32System::Int32

A signed number that indicates the relative order of value1 and value2. The return value has the following meanings.

  • Less than zero indicates that value1 is less than value2.
  • Zero indicates that value1 is equal to value2.
  • Greater than zero indicates that value1 is greater than value2.

Exceptions

ExceptionCondition
ArgumentNullExceptionArgumentNullExceptionArgumentNullException value1 or value2 is null a null reference (Nothing in Visual Basic) nullptr.

Remarks

This method implements the fn:compare function, and is used by the greater than, greater equal, less than and less equal operators for the specified collation, and should follow the same semantics.