CompilerErrorCollection Klasse

Definition

Stellt eine Auflistung von CompilerError-Objekten dar.

public ref class CompilerErrorCollection : System::Collections::CollectionBase
public class CompilerErrorCollection : System.Collections.CollectionBase
[System.Serializable]
public class CompilerErrorCollection : System.Collections.CollectionBase
type CompilerErrorCollection = class
    inherit CollectionBase
[<System.Serializable>]
type CompilerErrorCollection = class
    inherit CollectionBase
Public Class CompilerErrorCollection
Inherits CollectionBase
Vererbung
CompilerErrorCollection
Attribute

Beispiele

Im folgenden Beispiel wird die Verwendung der CompilerErrorCollection-Klasse veranschaulicht. Das Beispiel erstellt eine neue instance der -Klasse und verwendet mehrere Methoden, um der Auflistung Anweisungen hinzuzufügen, ihren Index zurückzugeben und Attribute an einem bestimmten Indexpunkt hinzuzufügen oder zu entfernen.

// Creates an empty CompilerErrorCollection.
CompilerErrorCollection^ collection = gcnew CompilerErrorCollection;

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

// Adds an array of CompilerError objects to the collection.
array<CompilerError^>^errors = {gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" ),gcnew CompilerError( "Testfile::cs",5,10,"CS0001","Example error text" )};
collection->AddRange( errors );

// Adds a collection of CompilerError objects to the collection.
CompilerErrorCollection^ errorsCollection = gcnew CompilerErrorCollection;
errorsCollection->Add( gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" ) );
errorsCollection->Add( gcnew 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 = gcnew 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, gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" ) );

// Removes the specified CompilerError from the collection.
CompilerError^ error = gcnew 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.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.
Dim collection As 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.
Dim errors As CompilerError() = {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.
Dim errorsCollection As 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.
Dim testError As New CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text")
Dim itemIndex As Integer = -1
If collection.Contains(testError) Then
    itemIndex = collection.IndexOf(testError)
End If

' 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.
Dim collectionCount As Integer = 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.
Dim [error] As New CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text")
collection.Remove([error])

' Removes the CompilerError at index 0.
collection.RemoveAt(0)

Hinweise

Die CompilerErrorCollection-Klasse stellt ein einfaches Auflistungsobjekt bereit, mit dem ein Satz von CompilerError-Objekten gespeichert werden kann.

Hinweis

Diese Klasse enthält eine Vererbungsanforderung auf Klassenebene, die für alle Member gilt. Ein SecurityException wird ausgelöst, wenn die abgeleitete Klasse nicht über die Vollvertrauensberechtigung verfügt. Ausführliche Informationen zu Vererbungsanforderungen finden Sie unter Vererbungsanforderungen.

Konstruktoren

CompilerErrorCollection()

Initialisiert eine neue Instanz der CompilerErrorCollection-Klasse.

CompilerErrorCollection(CompilerError[])

Initialisiert eine neue Instanz der CompilerErrorCollection-Klasse, die das angegebene Array von CompilerError-Objekten enthält.

CompilerErrorCollection(CompilerErrorCollection)

Initialisiert eine neue Instanz der CompilerErrorCollection-Klasse, die den Inhalt der angegebenen CompilerErrorCollection enthält.

Eigenschaften

Capacity

Ruft die Anzahl der Elemente ab, die die CollectionBase enthalten kann, oder legt diese fest.

(Geerbt von CollectionBase)
Count

Ruft die Anzahl der in der CollectionBase-Instanz enthaltenen Elemente ab. Diese Eigenschaft kann nicht überschrieben werden.

(Geerbt von CollectionBase)
HasErrors

Ruft einen Wert ab, der angibt, ob die Auflistung Fehler enthält.

HasWarnings

Ruft einen Wert ab, der angibt, ob die Auflistung Warnungen enthält.

InnerList

Ruft eine ArrayList mit der Liste der Elemente in der CollectionBase-Instanz ab.

(Geerbt von CollectionBase)
Item[Int32]

Ruft die CompilerError-Klasse am angegebenen Index ab oder legt diese fest.

List

Ruft eine IList mit der Liste der Elemente in der CollectionBase-Instanz ab.

(Geerbt von CollectionBase)

Methoden

Add(CompilerError)

Fügt der Fehlerauflistung das angegebene CompilerError-Objekt hinzu.

AddRange(CompilerError[])

Kopiert die Elemente eines Arrays an das Ende der Fehlerauflistung.

AddRange(CompilerErrorCollection)

Fügt den Inhalt der angegebenen Compilerfehlerauflistung am Ende der Fehlerauflistung hinzu.

Clear()

Entfernt alle Objekte aus der CollectionBase-Instanz. Diese Methode kann nicht überschrieben werden.

(Geerbt von CollectionBase)
Contains(CompilerError)

Ruft einen Wert ab, der angibt, ob die Auflistung das angegebene CompilerError-Objekt enthält.

CopyTo(CompilerError[], Int32)

Kopiert die Auflistungswerte am angegebenen Index in eine eindimensionale Array-Instanz.

Equals(Object)

Bestimmt, ob das angegebene Objekt gleich dem aktuellen Objekt ist.

(Geerbt von Object)
GetEnumerator()

Gibt einen Enumerator zurück, der die CollectionBase durchläuft.

(Geerbt von CollectionBase)
GetHashCode()

Fungiert als Standardhashfunktion.

(Geerbt von Object)
GetType()

Ruft den Type der aktuellen Instanz ab.

(Geerbt von Object)
IndexOf(CompilerError)

Ruft den Index des angegebenen CompilerError-Objekts in der Auflistung ab, sofern es in der Auflistung vorhanden ist.

Insert(Int32, CompilerError)

Fügt die angegebene CompilerError-Klasse am angegebenen Index in die Auflistung ein.

MemberwiseClone()

Erstellt eine flache Kopie des aktuellen Object.

(Geerbt von Object)
OnClear()

Führt beim Löschen des Inhalts der CollectionBase-Instanz zusätzliche benutzerdefinierte Prozesse aus.

(Geerbt von CollectionBase)
OnClearComplete()

Führt nach dem Löschen des Inhalts der CollectionBase-Instanz zusätzliche benutzerdefinierte Prozesse aus.

(Geerbt von CollectionBase)
OnInsert(Int32, Object)

Führt zusätzliche benutzerdefinierte Prozesse vor dem Einfügen eines neuen Elements in die CollectionBase-Instanz aus.

(Geerbt von CollectionBase)
OnInsertComplete(Int32, Object)

Führt zusätzliche benutzerdefinierte Prozesse nach dem Einfügen eines neuen Elements in die CollectionBase-Instanz aus.

(Geerbt von CollectionBase)
OnRemove(Int32, Object)

Führt zusätzliche benutzerdefinierte Prozesse beim Entfernen eines Elements aus der CollectionBase-Instanz aus.

(Geerbt von CollectionBase)
OnRemoveComplete(Int32, Object)

Führt zusätzliche benutzerdefinierte Prozesse nach dem Entfernen eines Elements aus der CollectionBase-Instanz aus.

(Geerbt von CollectionBase)
OnSet(Int32, Object, Object)

Führt zusätzliche benutzerdefinierte Prozesse vor dem Festlegen eines Werts in der CollectionBase-Instanz aus.

(Geerbt von CollectionBase)
OnSetComplete(Int32, Object, Object)

Führt zusätzliche benutzerdefinierte Prozesse nach dem Festlegen eines Werts in der CollectionBase-Instanz aus.

(Geerbt von CollectionBase)
OnValidate(Object)

Führt zusätzliche benutzerdefinierte Prozesse beim Validieren eines Werts aus.

(Geerbt von CollectionBase)
Remove(CompilerError)

Entfernt eine bestimmte CompilerError-Klasse aus der Auflistung.

RemoveAt(Int32)

Entfernt das Element am angegebenen Index aus der CollectionBase-Instanz. Diese Methode kann nicht überschrieben werden.

(Geerbt von CollectionBase)
ToString()

Gibt eine Zeichenfolge zurück, die das aktuelle Objekt darstellt.

(Geerbt von Object)

Explizite Schnittstellenimplementierungen

ICollection.CopyTo(Array, Int32)

Kopiert die gesamte CollectionBase-Instanz in ein kompatibles eindimensionales Array, beginnend am angegebenen Index des Zielarrays.

(Geerbt von CollectionBase)
ICollection.IsSynchronized

Ruft einen Wert ab, der angibt, ob der Zugriff auf die CollectionBase synchronisiert (threadsicher) ist.

(Geerbt von CollectionBase)
ICollection.SyncRoot

Ruft ein Objekt ab, mit dem der Zugriff auf CollectionBase synchronisiert werden kann.

(Geerbt von CollectionBase)
IList.Add(Object)

Fügt am Ende der CollectionBase ein Objekt hinzu.

(Geerbt von CollectionBase)
IList.Contains(Object)

Ermittelt, ob CollectionBase ein bestimmtes Element enthält.

(Geerbt von CollectionBase)
IList.IndexOf(Object)

Sucht nach dem angegebenen Object und gibt den nullbasierten Index des ersten Vorkommens innerhalb der gesamten CollectionBase zurück.

(Geerbt von CollectionBase)
IList.Insert(Int32, Object)

Fügt am angegebenen Index ein Element in die CollectionBase ein.

(Geerbt von CollectionBase)
IList.IsFixedSize

Ruft einen Wert ab, der angibt, ob das CollectionBase eine feste Größe aufweist.

(Geerbt von CollectionBase)
IList.IsReadOnly

Ruft einen Wert ab, der angibt, ob das CollectionBase schreibgeschützt ist.

(Geerbt von CollectionBase)
IList.Item[Int32]

Ruft das Element am angegebenen Index ab oder legt dieses fest.

(Geerbt von CollectionBase)
IList.Remove(Object)

Entfernt das erste Vorkommen eines angegebenen Objekts aus der CollectionBase.

(Geerbt von CollectionBase)

Erweiterungsmethoden

Cast<TResult>(IEnumerable)

Wandelt die Elemente eines IEnumerable in den angegebenen Typ um

OfType<TResult>(IEnumerable)

Filtert die Elemente eines IEnumerable anhand eines angegebenen Typs

AsParallel(IEnumerable)

Ermöglicht die Parallelisierung einer Abfrage.

AsQueryable(IEnumerable)

Konvertiert einen IEnumerable in einen IQueryable.

Gilt für:

Weitere Informationen