Share via


CodeArrayIndexerExpression 類別

定義

表示陣列索引的參考。

public ref class CodeArrayIndexerExpression : System::CodeDom::CodeExpression
public class CodeArrayIndexerExpression : System.CodeDom.CodeExpression
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeArrayIndexerExpression : System.CodeDom.CodeExpression
type CodeArrayIndexerExpression = class
    inherit CodeExpression
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeArrayIndexerExpression = class
    inherit CodeExpression
Public Class CodeArrayIndexerExpression
Inherits CodeExpression
繼承
CodeArrayIndexerExpression
屬性

範例

下列程式代碼會建立 , CodeArrayIndexerExpression 參考名為 x 之整數陣列的索引 5:


// Create an array indexer expression that references index 5 of array "x"
array<CodeExpression^>^temp = {gcnew CodePrimitiveExpression( 5 )};
CodeArrayIndexerExpression^ ci1 = gcnew CodeArrayIndexerExpression( gcnew CodeVariableReferenceExpression( "x" ),temp );

// A C# code generator produces the following source code for the preceeding example code:
// x[5]
// 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]
' 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]

備註

CodeArrayIndexerExpression 可用來表示一或多個維度陣列之索引的參考。 用於 CodeIndexerExpression 表示程式代碼索引的參考, (非陣列) 索引器。 屬性 TargetObject 會指出索引器物件。 屬性 Indices 會指出目標陣列內的單一索引,或一組一起指定陣列維度中索引的特定交集索引。

建構函式

CodeArrayIndexerExpression()

初始化 CodeArrayIndexerExpression 類別的新執行個體。

CodeArrayIndexerExpression(CodeExpression, CodeExpression[])

使用指定的目標物件和索引來初始化 CodeArrayIndexerExpression 類別的新執行個體。

屬性

Indices

取得或設定索引子運算式的索引。

TargetObject

取得或設定這個陣列索引子的目標物件。

UserData

取得目前物件的使用者可定義資料。

(繼承來源 CodeObject)

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於