Show / Hide Table of Contents

    PbArray<T>.SetValue(T value, int index1, int index2) Method

    .NET Standard 2.x

    Sets a value to the element at the specified position in the two-dimensional PbArray.

    Namespace: PowerScript.Bridge

    Assembly: PowerScript.Bridge.dll

    Syntax

    public void SetValue(T value, int index1, int index2);
    

    Parameters

    value T

    The new value for the specified element.

    index1 System.Int32

    A 32-bit integer that represents the first-dimension index of the PbArray element to set.

    index2 System.Int32

    A 32-bit integer that represents the second-dimension index of the PbArray element to set.

    Examples

    The following code example demonstrates how to use the SetValue(T value, int index1, int index2) method to set values at the specified position in the two-dimensional array.

    using System;
    using PowerScript.Bridge;
    
    namespace Appeon.ApiDoc.PbArrayExamples
    {
        public class SetValueExample
        {
            public void Example2()
            {
                // Creates a PbArray object which is a 2x2 two-dimensional array
                PbArray<string> pbArray = new PbArray<string>(2, 2);
                pbArray.SetValue("one", 0, 0);
                pbArray.SetValue("two", 0, 1);
                pbArray.SetValue("three", 1, 0);
                pbArray.SetValue("four", 1, 1);
    
                // Shows the data of pbArray
                Console.WriteLine(pbArray.GetValue(0, 0));
                Console.WriteLine(pbArray.GetValue(0, 1));
                Console.WriteLine(pbArray.GetValue(1, 0));
                Console.WriteLine(pbArray.GetValue(1, 1));
    
                /*This code produces the following output:
                
                one
                two
                three
                four
                */
            }
        }
    }
    

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon