1 //------------------------------------------------------------------------------ 2 // <copyright file="CodeIndexerExpression.cs" company="Microsoft"> 3 // 4 // <OWNER>Microsoft</OWNER> 5 // Copyright (c) Microsoft Corporation. All rights reserved. 6 // </copyright> 7 //------------------------------------------------------------------------------ 8 9 namespace System.CodeDom { 10 11 using System.Diagnostics; 12 using System; 13 using Microsoft.Win32; 14 using System.Collections; 15 using System.Runtime.InteropServices; 16 17 /// <devdoc> 18 /// <para> 19 /// Represents an array indexer expression. 20 /// </para> 21 /// </devdoc> 22 [ 23 ClassInterface(ClassInterfaceType.AutoDispatch), 24 ComVisible(true), 25 Serializable, 26 ] 27 public class CodeIndexerExpression : CodeExpression { 28 private CodeExpression targetObject; 29 private CodeExpressionCollection indices; 30 31 /// <devdoc> 32 /// <para> 33 /// Initializes a new instance of <see cref='System.CodeDom.CodeIndexerExpression'/>. 34 /// </para> 35 /// </devdoc> CodeIndexerExpression()36 public CodeIndexerExpression() { 37 } 38 39 /// <devdoc> 40 /// <para> 41 /// Initializes a new instance of <see cref='System.CodeDom.CodeIndexerExpression'/> using the specified target 42 /// object and index. 43 /// </para> 44 /// </devdoc> CodeIndexerExpression(CodeExpression targetObject, params CodeExpression[] indices)45 public CodeIndexerExpression(CodeExpression targetObject, params CodeExpression[] indices) { 46 this.targetObject = targetObject; 47 this.indices = new CodeExpressionCollection(); 48 this.indices.AddRange(indices); 49 } 50 51 /// <devdoc> 52 /// <para> 53 /// Gets or sets 54 /// the target object. 55 /// </para> 56 /// </devdoc> 57 public CodeExpression TargetObject { 58 get { 59 return targetObject; 60 } 61 set { 62 targetObject = value; 63 } 64 } 65 66 /// <devdoc> 67 /// <para> 68 /// Gets or sets 69 /// the index. 70 /// </para> 71 /// </devdoc> 72 public CodeExpressionCollection Indices { 73 get { 74 if (indices == null) { 75 indices = new CodeExpressionCollection(); 76 } 77 return indices; 78 } 79 } 80 } 81 } 82