C# Array GetValue(Int32[]) Array
Description
Array GetValue(Int32[])
gets the value at the specified
position in the multidimensional Array. The indexes are specified as an
array of 32-bit integers.
Syntax
Array.GetValue(Int32[])
has the following syntax.
public Object GetValue(
params int[] indices
)
Parameters
Array.GetValue(Int32[])
has the following parameters.
indices
- A one-dimensional array of 32-bit integers that represent the indexes specifying the position of the Array element to get.
Returns
Array.GetValue(Int32[])
method returns The value at the specified position in the multidimensional Array.
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 . j av a 2 s . c o m*/
public class SamplesArray {
public static void Main() {
String[,,,,,,] myArr7 = new String[5,5,5,5,5,5,5];
int[] myIndices = new int[7] { 1, 2, 3, 0, 1, 2, 3 };
myArr7.SetValue( "one-two-three-zero-one-two-three", myIndices );
Console.WriteLine( "[1,2,3,0,1,2,3]: {0}", myArr7.GetValue( myIndices ) );
}
}
The code above generates the following result.