1 // ------------------------------------------------------------------------------
2 // <copyright file="CompilerErrorCollection.cs" company="Microsoft">
4 // <OWNER>[....]</OWNER>
5 // Copyright (c) Microsoft Corporation. All rights reserved.
7 // ------------------------------------------------------------------------------
9 namespace System.CodeDom.Compiler {
11 using System.Collections;
12 using System.Security.Permissions;
17 /// A collection that stores <see cref='System.CodeDom.Compiler.CompilerError'/> objects.
21 [PermissionSet(SecurityAction.InheritanceDemand, Name="FullTrust")]
22 public class CompilerErrorCollection : CollectionBase {
26 /// Initializes a new instance of <see cref='System.CodeDom.Compiler.CompilerErrorCollection'/>.
29 public CompilerErrorCollection() {
34 /// Initializes a new instance of <see cref='System.CodeDom.Compiler.CompilerErrorCollection'/> based on another <see cref='System.CodeDom.Compiler.CompilerErrorCollection'/>.
37 public CompilerErrorCollection(CompilerErrorCollection value) {
43 /// Initializes a new instance of <see cref='System.CodeDom.Compiler.CompilerErrorCollection'/> containing any array of <see cref='System.CodeDom.Compiler.CompilerError'/> objects.
46 public CompilerErrorCollection(CompilerError[] value) {
51 /// <para>Represents the entry at the specified index of the <see cref='System.CodeDom.Compiler.CompilerError'/>.</para>
53 public CompilerError this[int index] {
55 return ((CompilerError)(List[index]));
63 /// <para>Adds a <see cref='System.CodeDom.Compiler.CompilerError'/> with the specified value to the
64 /// <see cref='System.CodeDom.Compiler.CompilerErrorCollection'/> .</para>
66 public int Add(CompilerError value) {
67 return List.Add(value);
71 /// <para>Copies the elements of an array to the end of the <see cref='System.CodeDom.Compiler.CompilerErrorCollection'/>.</para>
73 public void AddRange(CompilerError[] value) {
75 throw new ArgumentNullException("value");
77 for (int i = 0; ((i) < (value.Length)); i = ((i) + (1))) {
84 /// Adds the contents of another <see cref='System.CodeDom.Compiler.CompilerErrorCollection'/> to the end of the collection.
87 public void AddRange(CompilerErrorCollection value) {
89 throw new ArgumentNullException("value");
91 int currentCount = value.Count;
92 for (int i = 0; i < currentCount; i = ((i) + (1))) {
98 /// <para>Gets a value indicating whether the
99 /// <see cref='System.CodeDom.Compiler.CompilerErrorCollection'/> contains the specified <see cref='System.CodeDom.Compiler.CompilerError'/>.</para>
101 public bool Contains(CompilerError value) {
102 return List.Contains(value);
106 /// <para>Copies the <see cref='System.CodeDom.Compiler.CompilerErrorCollection'/> values to a one-dimensional <see cref='System.Array'/> instance at the
107 /// specified index.</para>
109 public void CopyTo(CompilerError[] array, int index) {
110 List.CopyTo(array, index);
116 /// a value indicating whether the collection contains errors.
119 public bool HasErrors {
122 foreach (CompilerError e in this) {
135 /// a value indicating whether the collection contains warnings.
138 public bool HasWarnings {
141 foreach (CompilerError e in this) {
152 /// <para>Returns the index of a <see cref='System.CodeDom.Compiler.CompilerError'/> in
153 /// the <see cref='System.CodeDom.Compiler.CompilerErrorCollection'/> .</para>
155 public int IndexOf(CompilerError value) {
156 return List.IndexOf(value);
160 /// <para>Inserts a <see cref='System.CodeDom.Compiler.CompilerError'/> into the <see cref='System.CodeDom.Compiler.CompilerErrorCollection'/> at the specified index.</para>
162 public void Insert(int index, CompilerError value) {
163 List.Insert(index, value);
167 /// <para> Removes a specific <see cref='System.CodeDom.Compiler.CompilerError'/> from the
168 /// <see cref='System.CodeDom.Compiler.CompilerErrorCollection'/> .</para>
170 public void Remove(CompilerError value) {