The Labs \ Source Viewer \ SSCLI \ System.CodeDom \ CodeExpressionCollection

  1. // ------------------------------------------------------------------------------
  2. // <copyright file="CodeExpressionCollection.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. // ------------------------------------------------------------------------------
  15. //
  16. namespace System.CodeDom
  17. {
  18.     using System;
  19.     using System.Collections;
  20.     using System.Runtime.InteropServices;
  21.    
  22.    
  23.     /// <devdoc>
  24.     /// <para>
  25.     /// A collection that stores <see cref='System.CodeDom.CodeExpression'/> objects.
  26.     /// </para>
  27.     /// </devdoc>
  28.     [ClassInterface(ClassInterfaceType.AutoDispatch), ComVisible(true), Serializable()]
  29.     public class CodeExpressionCollection : CollectionBase
  30.     {
  31.        
  32.         /// <devdoc>
  33.         /// <para>
  34.         /// Initializes a new instance of <see cref='System.CodeDom.CodeExpressionCollection'/>.
  35.         /// </para>
  36.         /// </devdoc>
  37.         public CodeExpressionCollection()
  38.         {
  39.         }
  40.        
  41.         /// <devdoc>
  42.         /// <para>
  43.         /// Initializes a new instance of <see cref='System.CodeDom.CodeExpressionCollection'/> based on another <see cref='System.CodeDom.CodeExpressionCollection'/>.
  44.         /// </para>
  45.         /// </devdoc>
  46.         public CodeExpressionCollection(CodeExpressionCollection value)
  47.         {
  48.             this.AddRange(value);
  49.         }
  50.        
  51.         /// <devdoc>
  52.         /// <para>
  53.         /// Initializes a new instance of <see cref='System.CodeDom.CodeExpressionCollection'/> containing any array of <see cref='System.CodeDom.CodeExpression'/> objects.
  54.         /// </para>
  55.         /// </devdoc>
  56.         public CodeExpressionCollection(CodeExpression[] value)
  57.         {
  58.             this.AddRange(value);
  59.         }
  60.        
  61.         /// <devdoc>
  62.         /// <para>Represents the entry at the specified index of the <see cref='System.CodeDom.CodeExpression'/>.</para>
  63.         /// </devdoc>
  64.         public CodeExpression this[int index]
  65.         {
  66.             get { return ((CodeExpression)(List[index])); }
  67.             set { List[index] = value; }
  68.         }
  69.        
  70.         /// <devdoc>
  71.         /// <para>Adds a <see cref='System.CodeDom.CodeExpression'/> with the specified value to the
  72.         /// <see cref='System.CodeDom.CodeExpressionCollection'/> .</para>
  73.         /// </devdoc>
  74.         public int Add(CodeExpression value)
  75.         {
  76.             return List.Add(value);
  77.         }
  78.        
  79.         /// <devdoc>
  80.         /// <para>Copies the elements of an array to the end of the <see cref='System.CodeDom.CodeExpressionCollection'/>.</para>
  81.         /// </devdoc>
  82.         public void AddRange(CodeExpression[] value)
  83.         {
  84.             if (value == null) {
  85.                 throw new ArgumentNullException("value");
  86.             }
  87.             for (int i = 0; ((i) < (value.Length)); i = ((i)+(1))) {
  88.                 this.Add(value[i]);
  89.             }
  90.         }
  91.        
  92.         /// <devdoc>
  93.         /// <para>
  94.         /// Adds the contents of another <see cref='System.CodeDom.CodeExpressionCollection'/> to the end of the collection.
  95.         /// </para>
  96.         /// </devdoc>
  97.         public void AddRange(CodeExpressionCollection value)
  98.         {
  99.             if (value == null) {
  100.                 throw new ArgumentNullException("value");
  101.             }
  102.             int currentCount = value.Count;
  103.             for (int i = 0; i < currentCount; i = ((i)+(1))) {
  104.                 this.Add(value[i]);
  105.             }
  106.         }
  107.        
  108.         /// <devdoc>
  109.         /// <para>Gets a value indicating whether the
  110.         /// <see cref='System.CodeDom.CodeExpressionCollection'/> contains the specified <see cref='System.CodeDom.CodeExpression'/>.</para>
  111.         /// </devdoc>
  112.         public bool Contains(CodeExpression value)
  113.         {
  114.             return List.Contains(value);
  115.         }
  116.        
  117.         /// <devdoc>
  118.         /// <para>Copies the <see cref='System.CodeDom.CodeExpressionCollection'/> values to a one-dimensional <see cref='System.Array'/> instance at the
  119.         /// specified index.</para>
  120.         /// </devdoc>
  121.         public void CopyTo(CodeExpression[] array, int index)
  122.         {
  123.             List.CopyTo(array, index);
  124.         }
  125.        
  126.         /// <devdoc>
  127.         /// <para>Returns the index of a <see cref='System.CodeDom.CodeExpression'/> in
  128.         /// the <see cref='System.CodeDom.CodeExpressionCollection'/> .</para>
  129.         /// </devdoc>
  130.         public int IndexOf(CodeExpression value)
  131.         {
  132.             return List.IndexOf(value);
  133.         }
  134.        
  135.         /// <devdoc>
  136.         /// <para>Inserts a <see cref='System.CodeDom.CodeExpression'/> into the <see cref='System.CodeDom.CodeExpressionCollection'/> at the specified index.</para>
  137.         /// </devdoc>
  138.         public void Insert(int index, CodeExpression value)
  139.         {
  140.             List.Insert(index, value);
  141.         }
  142.        
  143.         /// <devdoc>
  144.         /// <para> Removes a specific <see cref='System.CodeDom.CodeExpression'/> from the
  145.         /// <see cref='System.CodeDom.CodeExpressionCollection'/> .</para>
  146.         /// </devdoc>
  147.         public void Remove(CodeExpression value)
  148.         {
  149.             List.Remove(value);
  150.         }
  151.     }
  152. }

Developer Fusion