Show / Hide Table of Contents

    PbArray<T>.GetUpperBound(int dimension) Method

    .NET Standard 2.x

    Gets the index of the last element of the specified dimension in the PbArray.

    Namespace: PowerScript.Bridge

    Assembly: PowerScript.Bridge.dll

    Syntax

    public int GetUpperBound(int dimension);
    

    Parameters

    dimension System.Int32

    A zero-based dimension of the PbArray whose upper bound needs to be determined.

    Returns

    System.Int32

    The index of the last element of the specified dimension in the PbArray, or -1 if the specified dimension is empty.

    Examples

    The following code example demonstrates how to use the the GetLowerBound and GetUpperBound methods to show the bound of a one-dimensional array.

    using System;
    using PowerScript.Bridge;
    
    namespace Appeon.ApiDoc.PbArrayExamples
    {
        public class GetUpperBoundExample
        {
            public void Example()
            {
                // Creates a PbArray object and assigns values
                PbArray<int> pbArray = new PbArray<int>() { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 };
    
                int lower = pbArray.GetLowerBound(0);
                int upper = pbArray.GetUpperBound(0);
    
                Console.WriteLine($"LowerBound={lower}, UpperBound={upper}");
    
                /*This code produces the following output:
                
                LowerBound=0, UpperBound=9
                */
            }
        }
    }
    

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon