This documentation is archived and is not being maintained.

CodeArrayIndexerExpression Class

Represents a reference to an index of an array.

For a list of all members of this type, see CodeArrayIndexerExpression Members.

System.Object
   System.CodeDom.CodeObject
      System.CodeDom.CodeExpression
         System.CodeDom.CodeArrayIndexerExpression

[Visual Basic]
<Serializable>
<ClassInterface(ClassInterfaceType.AutoDispatch)>
<ComVisible(True)>
Public Class CodeArrayIndexerExpression
   Inherits CodeExpression
[C#]
[Serializable]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[ComVisible(true)]
public class CodeArrayIndexerExpression : CodeExpression
[C++]
[Serializable]
[ClassInterface(ClassInterfaceType::AutoDispatch)]
[ComVisible(true)]
public __gc class CodeArrayIndexerExpression : public
   CodeExpression
[JScript]
public
   Serializable
 ClassInterface(ClassInterfaceType.AutoDispatch)
 ComVisible(true)
class CodeArrayIndexerExpression extends CodeExpression

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Remarks

CodeArrayIndexerExpression can be used to represent a reference to an index of an array of one or more dimensions. Use CodeIndexerExpression for representing a reference to an index of a code (non-array) indexer. The TargetObject property indicates the indexer object. The Indices property indicates either a single index within the target array, or a set of indexes that together specify a specific intersection of indexes across the dimensions of the array.

Example

[Visual Basic, C#, C++] The following code creates a CodeArrayIndexerExpression that references index 5 of an array of integers named x:

[Visual Basic] 
' Create an array indexer expression that references index 5 of array "x"
Dim ci1 As New CodeArrayIndexerExpression(New CodeVariableReferenceExpression("x"), New CodePrimitiveExpression(5))

' A Visual Basic code generator produces the following source code for the preceeding example code:

' x[5]

[C#] 
// Create an array indexer expression that references index 5 of array "x"
CodeArrayIndexerExpression ci1 = new CodeArrayIndexerExpression(new CodeVariableReferenceExpression("x"), new CodePrimitiveExpression(5));

// A C# code generator produces the following source code for the preceeding example code:

// x[5]

[C++] 
// Create an array indexer expression that references index 5 of array "x"
CodeExpression* temp[] = {new CodePrimitiveExpression(__box(5)) };
CodeArrayIndexerExpression* ci1 = new CodeArrayIndexerExpression(
    new CodeVariableReferenceExpression(S"x"), temp);

// A C# code generator produces the following source code for the preceeding example code:

// x[5]

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.CodeDom

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System (in System.dll)

See Also

CodeArrayIndexerExpression Members | System.CodeDom Namespace

Show: