C# Array SetValue(Object, Int64, Int64, Int64)
Description
Array SetValue(Object, Int64, Int64, Int64)
sets a value
to the element at the specified position in the three-dimensional Array.
The indexes are specified as 64-bit integers.
Syntax
Array.SetValue(Object, Int64, Int64, Int64)
has the following syntax.
[ComVisibleAttribute(false)]/*from w ww. j av a2s.co m*/
public void SetValue(
Object value,
long index1,
long index2,
long index3
)
Parameters
Array.SetValue(Object, Int64, Int64, Int64)
has the following parameters.
value
- The new value for the specified element.index1
- A 64-bit integer that represents the first-dimension index of the Array element to set.index2
- A 64-bit integer that represents the second-dimension index of the Array element to set.index3
- A 64-bit integer that represents the third-dimension index of the Array element to set.
Returns
Array.SetValue(Object, Int64, Int64, Int64)
method returns
Example
The following code example demonstrates how to set and get a specific value in a one-dimensional or multidimensional array.
using System;/*from ww w .ja va 2s .c o m*/
public class SamplesArray {
public static void Main() {
String[,,] myArr3 = new String[5,5,5];
myArr3.SetValue( "one-two-three", 1, 2, 3 );
Console.WriteLine( "[1,2,3]: {0}", myArr3.GetValue( 1, 2, 3 ) );
}
}
The code above generates the following result.