CodeArrayIndexerExpression CodeArrayIndexerExpression CodeArrayIndexerExpression CodeArrayIndexerExpression Class

定義

表示陣列索引的參考。Represents a reference to an index of an array.

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

範例

下列CodeArrayIndexerExpression程式碼會建立, 它會參考名為x之整數陣列的索引 5:The following code creates a CodeArrayIndexerExpression that references index 5 of an array of integers named x :


// 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可用來代表一或多個維度之陣列索引的參考。CodeArrayIndexerExpression can be used to represent a reference to an index of an array of one or more dimensions. CodeIndexerExpression來代表程式碼 (非陣列) 索引子之索引的參考。Use CodeIndexerExpression for representing a reference to an index of a code (non-array) indexer. TargetObject屬性會指出索引子物件。The TargetObject property indicates the indexer object. Indices屬性會指出目標陣列內的單一索引, 或一組索引, 同時在陣列的維度上指定索引的特定交集。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.

建構函式

CodeArrayIndexerExpression() CodeArrayIndexerExpression() CodeArrayIndexerExpression() CodeArrayIndexerExpression()

初始化 CodeArrayIndexerExpression 類別的新執行個體。Initializes a new instance of the CodeArrayIndexerExpression class.

CodeArrayIndexerExpression(CodeExpression, CodeExpression[]) CodeArrayIndexerExpression(CodeExpression, CodeExpression[]) CodeArrayIndexerExpression(CodeExpression, CodeExpression[]) CodeArrayIndexerExpression(CodeExpression, CodeExpression[])

使用指定的目標物件和索引來初始化 CodeArrayIndexerExpression 類別的新執行個體。Initializes a new instance of the CodeArrayIndexerExpression class using the specified target object and indexes.

屬性

Indices Indices Indices Indices

取得或設定索引子運算式的索引。Gets or sets the index or indexes of the indexer expression.

TargetObject TargetObject TargetObject TargetObject

取得或設定這個陣列索引子的目標物件。Gets or sets the target object of the array indexer.

UserData UserData UserData UserData

取得目前物件的使用者可定義資料。Gets the user-definable data for the current object.

(Inherited from CodeObject)

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

適用於