CodeArrayIndexerExpression 类

定义

表示对数组的索引的引用。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
继承
CodeArrayIndexerExpression
属性

示例

下面的代码创建一个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 类的新实例。Initializes a new instance of the CodeArrayIndexerExpression class.

CodeArrayIndexerExpression(CodeExpression, CodeExpression[])

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

属性

Indices

获取或设置索引器表达式的一个或多个索引。Gets or sets the index or indexes of the indexer expression.

TargetObject

获取或设置此数组索引器的目标对象。Gets or sets the target object of the array indexer.

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)

适用于