// ------------------------------------------------------------------------------ // // // [....] // Copyright (c) Microsoft Corporation. All rights reserved. // // ------------------------------------------------------------------------------ // namespace System.CodeDom.Compiler { using System; using System.Collections; using System.Security.Permissions; /// /// /// A collection that stores objects. /// /// [Serializable()] [PermissionSet(SecurityAction.InheritanceDemand, Name="FullTrust")] public class CompilerErrorCollection : CollectionBase { /// /// /// Initializes a new instance of . /// /// public CompilerErrorCollection() { } /// /// /// Initializes a new instance of based on another . /// /// public CompilerErrorCollection(CompilerErrorCollection value) { this.AddRange(value); } /// /// /// Initializes a new instance of containing any array of objects. /// /// public CompilerErrorCollection(CompilerError[] value) { this.AddRange(value); } /// /// Represents the entry at the specified index of the . /// public CompilerError this[int index] { get { return ((CompilerError)(List[index])); } set { List[index] = value; } } /// /// Adds a with the specified value to the /// . /// public int Add(CompilerError value) { return List.Add(value); } /// /// Copies the elements of an array to the end of the . /// public void AddRange(CompilerError[] value) { if (value == null) { throw new ArgumentNullException("value"); } for (int i = 0; ((i) < (value.Length)); i = ((i) + (1))) { this.Add(value[i]); } } /// /// /// Adds the contents of another to the end of the collection. /// /// public void AddRange(CompilerErrorCollection value) { if (value == null) { throw new ArgumentNullException("value"); } int currentCount = value.Count; for (int i = 0; i < currentCount; i = ((i) + (1))) { this.Add(value[i]); } } /// /// Gets a value indicating whether the /// contains the specified . /// public bool Contains(CompilerError value) { return List.Contains(value); } /// /// Copies the values to a one-dimensional instance at the /// specified index. /// public void CopyTo(CompilerError[] array, int index) { List.CopyTo(array, index); } /// /// /// Gets or sets /// a value indicating whether the collection contains errors. /// /// public bool HasErrors { get { if (Count > 0) { foreach (CompilerError e in this) { if (!e.IsWarning) { return true; } } } return false; } } /// /// /// Gets or sets /// a value indicating whether the collection contains warnings. /// /// public bool HasWarnings { get { if (Count > 0) { foreach (CompilerError e in this) { if (e.IsWarning) { return true; } } } return false; } } /// /// Returns the index of a in /// the . /// public int IndexOf(CompilerError value) { return List.IndexOf(value); } /// /// Inserts a into the at the specified index. /// public void Insert(int index, CompilerError value) { List.Insert(index, value); } /// /// Removes a specific from the /// . /// public void Remove(CompilerError value) { List.Remove(value); } } }