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