CodeIndexerExpression CodeIndexerExpression CodeIndexerExpression CodeIndexerExpression Class

定義

表示物件的索引子 (Indexer) 屬性的參考。Represents a reference to an indexer property of an object.

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

範例

下列範例示範CodeIndexerExpression如何使用來參考目前物件的型別索引子。The following example demonstrates use of a CodeIndexerExpression to reference a type indexer for the current object.

array<CodePrimitiveExpression^>^temp1 = {gcnew CodePrimitiveExpression( 1 )};
System::CodeDom::CodeIndexerExpression^ indexerExpression = gcnew CodeIndexerExpression( gcnew CodeThisReferenceExpression,temp1 );

// A C# code generator produces the following source code for the preceeding example code:
//        this[1];
System.CodeDom.CodeIndexerExpression indexerExpression = new CodeIndexerExpression( new CodeThisReferenceExpression(), new CodePrimitiveExpression(1) );

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

//        this[1];        
Dim indexerExpression = New CodeIndexerExpression(New CodeThisReferenceExpression(), New CodePrimitiveExpression(1))

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

'       Me(1)            		

備註

CodeIndexerExpression可用來代表程式碼索引子或非陣列索引子的參考。CodeIndexerExpression can be used to represent a reference to a code indexer, or non-array indexer. CodeArrayIndexerExpression來代表陣列索引子的參考。Use CodeArrayIndexerExpression to represent a reference to array indexers.

建構函式

CodeIndexerExpression() CodeIndexerExpression() CodeIndexerExpression() CodeIndexerExpression()

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

CodeIndexerExpression(CodeExpression, CodeExpression[]) CodeIndexerExpression(CodeExpression, CodeExpression[]) CodeIndexerExpression(CodeExpression, CodeExpression[]) CodeIndexerExpression(CodeExpression, CodeExpression[])

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

屬性

Indices Indices Indices Indices

取得索引子運算式的索引集合。Gets the collection of indexes of the indexer expression.

TargetObject TargetObject TargetObject TargetObject

取得或設定可以索引的目標物件。Gets or sets the target object that can be indexed.

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)

適用於