PbArray<T>.SetValue(T value, int index) Method
.NET Standard 2.x
Sets a value to the element at the specified position in the one-dimensional PbArray.
Namespace: PowerScript.Bridge
Assembly: PowerScript.Bridge.dll
Syntax
public void SetValue(T value, int index);
Parameters
value
T
The new value for the specified element.
index
System.Int32
A 32-bit integer that represents the position of the Array element to set.
Examples
The following code example demonstrates how to use the SetValue(T value, int index) method to set values at the specified position in the one-dimensional array.
using System;
using PowerScript.Bridge;
namespace Appeon.ApiDoc.PbArrayExamples
{
public class SetValueExample
{
public void Example1()
{
// Creates a PbArray object
PbArray<int> pbArray = new PbArray<int>(3) ;
pbArray.SetValue(2, 0);
pbArray.SetValue(4, 1);
pbArray.SetValue(6, 2);
// Shows the data of pbArray
foreach (int item in pbArray)
{
Console.WriteLine(item);
}
/*This code produces the following output:
2
4
6
*/
}
}
}
Applies to
.NET Standard
2.x