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