C# Array GetValue(Int32, Int32, Int32)

Description

Array GetValue(Int32, Int32, Int32) gets the value at the specified position in the three-dimensional Array. The indexes are specified as 32-bit integers.

Syntax

Array.GetValue(Int32, Int32, Int32) has the following syntax.


public Object GetValue(
  int index1,//from  ww w.j a  v  a2s .co m
  int index2,
  int index3
)

Parameters

Array.GetValue(Int32, Int32, Int32) has the following parameters.

  • index1 - A 32-bit integer that represents the first-dimension index of the Array element to get.
  • index2 - A 32-bit integer that represents the second-dimension index of the Array element to get.
  • index3 - A 32-bit integer that represents the third-dimension index of the Array element to get.

Returns

Array.GetValue(Int32, Int32, Int32) method returns The value at the specified position in the three-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;//ww w . j  a  v a 2  s.c  o  m

public class SamplesArray  {

   public static void Main()  {

      // Creates and initializes a three-dimensional array.
      String[,,] myArr3 = new String[5,5,5];

      // Sets the element at index 1,2,3.
      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.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version