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

  1. // ------------------------------------------------------------------------------
  2. // <copyright file="CodeTypeReferenceCollection.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.CodeTypeReference'/> objects.
  26.     /// </para>
  27.     /// </devdoc>
  28.     [ClassInterface(ClassInterfaceType.AutoDispatch), ComVisible(true), Serializable()]
  29.     public class CodeTypeReferenceCollection : CollectionBase
  30.     {
  31.        
  32.         /// <devdoc>
  33.         /// <para>
  34.         /// Initializes a new instance of <see cref='System.CodeDom.CodeTypeReferenceCollection'/>.
  35.         /// </para>
  36.         /// </devdoc>
  37.         public CodeTypeReferenceCollection()
  38.         {
  39.         }
  40.        
  41.         /// <devdoc>
  42.         /// <para>
  43.         /// Initializes a new instance of <see cref='System.CodeDom.CodeTypeReferenceCollection'/> based on another <see cref='System.CodeDom.CodeTypeReferenceCollection'/>.
  44.         /// </para>
  45.         /// </devdoc>
  46.         public CodeTypeReferenceCollection(CodeTypeReferenceCollection value)
  47.         {
  48.             this.AddRange(value);
  49.         }
  50.        
  51.         /// <devdoc>
  52.         /// <para>
  53.         /// Initializes a new instance of <see cref='System.CodeDom.CodeTypeReferenceCollection'/> containing any array of <see cref='System.CodeDom.CodeTypeReference'/> objects.
  54.         /// </para>
  55.         /// </devdoc>
  56.         public CodeTypeReferenceCollection(CodeTypeReference[] 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.CodeTypeReference'/>.</para>
  63.         /// </devdoc>
  64.         public CodeTypeReference this[int index]
  65.         {
  66.             get { return ((CodeTypeReference)(List[index])); }
  67.             set { List[index] = value; }
  68.         }
  69.        
  70.         /// <devdoc>
  71.         /// <para>Adds a <see cref='System.CodeDom.CodeTypeReference'/> with the specified value to the
  72.         /// <see cref='System.CodeDom.CodeTypeReferenceCollection'/> .</para>
  73.         /// </devdoc>
  74.         public int Add(CodeTypeReference value)
  75.         {
  76.             return List.Add(value);
  77.         }
  78.        
  79.         /// <devdoc>
  80.         /// <para>[To be supplied.]</para>
  81.         /// </devdoc>
  82.         public void Add(string value)
  83.         {
  84.             Add(new CodeTypeReference(value));
  85.         }
  86.        
  87.         /// <devdoc>
  88.         /// <para>[To be supplied.]</para>
  89.         /// </devdoc>
  90.         public void Add(Type value)
  91.         {
  92.             Add(new CodeTypeReference(value));
  93.         }
  94.        
  95.         /// <devdoc>
  96.         /// <para>Copies the elements of an array to the end of the <see cref='System.CodeDom.CodeTypeReferenceCollection'/>.</para>
  97.         /// </devdoc>
  98.         public void AddRange(CodeTypeReference[] value)
  99.         {
  100.             if (value == null) {
  101.                 throw new ArgumentNullException("value");
  102.             }
  103.             for (int i = 0; ((i) < (value.Length)); i = ((i)+(1))) {
  104.                 this.Add(value[i]);
  105.             }
  106.         }
  107.        
  108.         /// <devdoc>
  109.         /// <para>
  110.         /// Adds the contents of another <see cref='System.CodeDom.CodeTypeReferenceCollection'/> to the end of the collection.
  111.         /// </para>
  112.         /// </devdoc>
  113.         public void AddRange(CodeTypeReferenceCollection value)
  114.         {
  115.             if (value == null) {
  116.                 throw new ArgumentNullException("value");
  117.             }
  118.             int currentCount = value.Count;
  119.             for (int i = 0; i < currentCount; i = ((i)+(1))) {
  120.                 this.Add(value[i]);
  121.             }
  122.         }
  123.        
  124.         /// <devdoc>
  125.         /// <para>Gets a value indicating whether the
  126.         /// <see cref='System.CodeDom.CodeTypeReferenceCollection'/> contains the specified <see cref='System.CodeDom.CodeTypeReference'/>.</para>
  127.         /// </devdoc>
  128.         public bool Contains(CodeTypeReference value)
  129.         {
  130.             return List.Contains(value);
  131.         }
  132.        
  133.         /// <devdoc>
  134.         /// <para>Copies the <see cref='System.CodeDom.CodeTypeReferenceCollection'/> values to a one-dimensional <see cref='System.Array'/> instance at the
  135.         /// specified index.</para>
  136.         /// </devdoc>
  137.         public void CopyTo(CodeTypeReference[] array, int index)
  138.         {
  139.             List.CopyTo(array, index);
  140.         }
  141.        
  142.         /// <devdoc>
  143.         /// <para>Returns the index of a <see cref='System.CodeDom.CodeTypeReference'/> in
  144.         /// the <see cref='System.CodeDom.CodeTypeReferenceCollection'/> .</para>
  145.         /// </devdoc>
  146.         public int IndexOf(CodeTypeReference value)
  147.         {
  148.             return List.IndexOf(value);
  149.         }
  150.        
  151.         /// <devdoc>
  152.         /// <para>Inserts a <see cref='System.CodeDom.CodeTypeReference'/> into the <see cref='System.CodeDom.CodeTypeReferenceCollection'/> at the specified index.</para>
  153.         /// </devdoc>
  154.         public void Insert(int index, CodeTypeReference value)
  155.         {
  156.             List.Insert(index, value);
  157.         }
  158.        
  159.         /// <devdoc>
  160.         /// <para> Removes a specific <see cref='System.CodeDom.CodeTypeReference'/> from the
  161.         /// <see cref='System.CodeDom.CodeTypeReferenceCollection'/> .</para>
  162.         /// </devdoc>
  163.         public void Remove(CodeTypeReference value)
  164.         {
  165.             List.Remove(value);
  166.         }
  167.     }
  168. }

Developer Fusion