CompareTo

This method compares the current instance to an object and returns an integer that represents their relative values

Declaration

// C#
public int CompareTo(object obj);

Parameters

Return Value

The method returns a number that is:

Implements

IComparable

Exceptions

ArgumentException - The parameter is not of type OracleBinary.

Remarks

The following rules apply to the behavior of this method.

Example

// C#

using System;
using Oracle.DataAccess.Types;

class CompareToSample
{
  static void Main(string[] args)
  {
    OracleBinary binary1 = new OracleBinary(new byte[] {1,2,3});
    OracleBinary binary2 = new OracleBinary(new byte[] {1,2,3,4});

    // Compare
    if (binary1.CompareTo(binary2) == 0)
      Console.WriteLine("binary1 is the same as binary2");
    else
      Console.WriteLine("binary1 is different from binary2");
  }
}

See Also: