CodeIndexerExpression 类

定义

表示对对象的索引器属性的引用。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
继承
CodeIndexerExpression
属性

示例

下面的示例演示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 类的新实例。Initializes a new instance of the CodeIndexerExpression class.

CodeIndexerExpression(CodeExpression, CodeExpression[])

使用指定的目标对象和索引初始化 CodeIndexerExpression 类的新实例。Initializes a new instance of the CodeIndexerExpression class using the specified target object and index.

属性

Indices

获取索引器表达式的索引集合。Gets the collection of indexes of the indexer expression.

TargetObject

获取或设置可以编制索引的目标对象。Gets or sets the target object that can be indexed.

UserData

获取当前对象的用户可定义数据。Gets the user-definable data for the current object.

(继承自 CodeObject)

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于