Este tema aún no ha recibido ninguna valoración - Valorar este tema

CompilerErrorCollection (Clase)

Representa una colección de objetos CompilerError.

Espacio de nombres: System.CodeDom.Compiler
Ensamblado: System (en system.dll)

[SerializableAttribute] 
public class CompilerErrorCollection : CollectionBase
/** @attribute SerializableAttribute() */ 
public class CompilerErrorCollection extends CollectionBase
SerializableAttribute 
public class CompilerErrorCollection extends CollectionBase

La clase CompilerErrorCollection proporciona un objeto de colección simple que se puede utilizar para almacenar un conjunto de objetos CompilerError.

NotaNota

Esta clase contiene una petición de herencia en el nivel de clase que se aplica a todos los miembros. Se produce una excepción SecurityException si la clase derivada no dispone de permisos de plena confianza. Para obtener más información sobre las peticiones de herencia, vea Peticiones de herencia.

// Creates an empty CompilerErrorCollection.
CompilerErrorCollection collection = new CompilerErrorCollection();                        

// Adds a CompilerError to the collection.
collection.Add( new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text") );

// Adds an array of CompilerError objects to the collection.
CompilerError[] errors = { new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text"), new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text") };
collection.AddRange( errors );

// Adds a collection of CompilerError objects to the collection.
CompilerErrorCollection errorsCollection = new CompilerErrorCollection();
errorsCollection.Add( new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text") );
errorsCollection.Add( new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text") );
collection.AddRange( errorsCollection );

// Tests for the presence of a CompilerError in the 
// collection, and retrieves its index if it is found.
CompilerError testError = new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text");
int itemIndex = -1;
if( collection.Contains( testError ) )
    itemIndex = collection.IndexOf( testError );

// Copies the contents of the collection, beginning at index 0, 
// to the specified CompilerError array.
// 'errors' is a CompilerError array.
collection.CopyTo( errors, 0 );

// Retrieves the count of the items in the collection.
int collectionCount = collection.Count;

// Inserts a CompilerError at index 0 of the collection.
collection.Insert( 0, new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text") );

// Removes the specified CompilerError from the collection.
CompilerError error = new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text");
collection.Remove( error );

// Removes the CompilerError at index 0.
collection.RemoveAt(0);

// Creates an empty CompilerErrorCollection.
CompilerErrorCollection collection = new CompilerErrorCollection();

// Adds a CompilerError to the collection.
collection.Add(new CompilerError("Testfile.cs", 5, 10, "CS0001", 
    "Example error text"));

// Adds an array of CompilerError objects to the collection.
CompilerError errors[] =  { new CompilerError("Testfile.cs", 5, 10, 
    "CS0001", "Example error text"), new CompilerError("Testfile.jsl", 5,
    10, "CS0001", "Example error text") };
collection.AddRange(errors);
// Adds a collection of CompilerError objects to the collection.
CompilerErrorCollection errorsCollection = new CompilerErrorCollection();
errorsCollection.Add(new CompilerError("Testfile.jsl", 5, 10, "CS0001",
    "Example error text"));
errorsCollection.Add(new CompilerError("Testfile.jsl", 5, 10, "JSL0001",
    "Example error text"));
collection.AddRange(errorsCollection);

// Tests for the presence of a CompilerError in the 
// collection, and retrieves its index if it is found.
CompilerError testError = new CompilerError("Testfile.JSL", 5, 10,
    "JSL0001", "Example error text");
int itemIndex = -1;
if (collection.Contains(testError)) {
    itemIndex = collection.IndexOf(testError);
}

// Copies the contents of the collection, beginning at index 0, 
// to the specified CompilerError array.
// 'errors' is a CompilerError array.
collection.CopyTo(errors, 0);

// Retrieves the count of the items in the collection.
int collectionCount = collection.get_Count();

// Inserts a CompilerError at index 0 of the collection.
collection.Insert(0, new CompilerError("Testfile.cs", 5, 10, "JSL0001",
    "Example error text"));

// Removes the specified CompilerError from the collection.
CompilerError error = new CompilerError("Testfile.cs", 5, 10, "JSL0001",
    "Example error text");
collection.Remove(error);

// Removes the CompilerError at index 0.
collection.RemoveAt(0);

System.Object
   System.Collections.CollectionBase
    System.CodeDom.Compiler.CompilerErrorCollection
Los miembros estáticos públicos (Shared en Visual Basic) de este tipo son seguros para la ejecución de subprocesos. No se garantiza que los miembros de instancias sean seguros para la ejecución de subprocesos.

Windows 98, Windows 2000 SP4, Windows Millennium, Windows Server 2003, Windows XP Media Center, Windows XP Professional x64, Windows XP SP2, Windows XP Starter Edition

.NET Framework no admite todas las versiones de cada plataforma. Para obtener una lista de las versiones admitidas, vea Requisitos del sistema.

.NET Framework

Compatible con: 2.0, 1.1, 1.0
¿Le ha resultado útil?
(Caracteres restantes: 1500)
Contenido de la comunidad Agregar