Home  |  Delphi .net Home  |  System.Array  |  GetUpperBound Method
GetUpperBound  
Method  
Gets the upper bound of a specified array dimension
Array Class
System NameSpace
CF1.  Function GetUpperBound ( Dimension : Integer; ) : Integer;
CF : Methods with this mark are Compact Framework Compatible
Description
The GetUpperBound method returns the ending index for the specified array Dimension.
 
This is 1 less than the size of this dimension since arrays are 0 based.
Microsoft MSDN Links
System
System.Array
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

var
  myArray : System.Array;
  upper   : Integer;

begin
  // Create a 10 element single dimension array of Integers
  myArray := System.Array.CreateInstance(TypeOf(Integer), 10);

  // Get the upper bound of the first and only (0) dimension
  upper := myArray.GetUpperBound(0);
  Console.WriteLine('UpperBound = {0}', upper.ToString);

  Console.ReadLine;
end.
Show full unit code
  UpperBound = 9
 
 
Delphi Programming © Neil Moffatt All rights reserved.  |  Contact the author