Home  |  Delphi .net Home  |  System.UInt16  |  CompareTo Method
  
CompareTo  
Method  
Compares the current UInt16 value to another
UInt16 Structure
System NameSpace
CF1.  Function CompareTo ( Target : Object ) : Integer;
CF : Methods with this mark are Compact Framework Compatible
Description
Compares the current (source) value with the Target value. The Target parameter must be a UInt16 object or a null reference.
 
Returns one of the following values :
 
Source < Target Gives <0
Source = Target Gives  0
Source > Target Gives >0

 
The exact value is not guaranteed.
Microsoft MSDN Links
System
System.UInt16
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

var
  valueA, valueB : UInt16;
  result     : Integer;

begin
  valueA := 23;
  valueB := 57;

  result := valueA.CompareTo(TObject(valueB));
  Console.WriteLine('valueA compared to valueB = {0}', result.ToString);

  result := valueB.CompareTo(TObject(valueB));
  Console.WriteLine('valueB compared to valueB = {0}', result.ToString);

  result := valueB.CompareTo(TObject(valueA));
  Console.WriteLine('valueB compared to valueA = {0}', result.ToString);

  Console.ReadLine;
end.
   valueA compared to valueB = -1
   valueB compared to valueB = 0
   valueB compared to valueA = 1
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author