ParserErrorCollection Klass

Definition

Hanterar en uppsättning parserfel som identifierats under parsningen. Det går inte att ärva den här klassen.

public ref class ParserErrorCollection sealed : System::Collections::CollectionBase
[System.Serializable]
public sealed class ParserErrorCollection : System.Collections.CollectionBase
[<System.Serializable>]
type ParserErrorCollection = class
    inherit CollectionBase
Public NotInheritable Class ParserErrorCollection
Inherits CollectionBase
Arv
ParserErrorCollection
Attribut

Exempel

Följande kodexempel visar hur du ParserErrorCollection använder metoderna.

// Create an empty ParserErrorCollection.
ParserErrorCollection collection = new ParserErrorCollection();

// Add a ParserError to the collection.
collection.Add(new ParserError("ErrorName", "Path", 1));

// Add an array of ParserError objects to the collection.
ParserError[] errors = 
    { new ParserError("Error 2", "Path", 1), 
    new ParserError("Error 3", "Path", 1) };
collection.AddRange(errors);

// Add a collection of ParserError objects to the collection.
ParserErrorCollection errorsCollection = new ParserErrorCollection();
errorsCollection.Add(new ParserError("Error", "Path", 1));
errorsCollection.Add(new ParserError("Error", "Path", 1));
collection.AddRange(errorsCollection);

// Test for the presence of a ParserError in the 
// collection, and retrieve its index if it is found.
ParserError testError = new ParserError("Error", "Path", 1);
int itemIndex = -1;
if (collection.Contains(testError))
  itemIndex = collection.IndexOf(testError);

// Copy the contents of the collection to a
// compatible array, starting at index 0 of the
// destination array. 
ParserError[] errorsToSort = new ParserError[5];
collection.CopyTo(errorsToSort, 0);

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

// Insert a ParserError at index 0 of the collection.
ParserError error = new ParserError("Error", "Path", 1);
collection.Insert(0, error);

// Remove the specified ParserError from the collection.
collection.Remove(error);

// Remove the ParserError at index 0.
collection.RemoveAt(0);
' Create an empty ParserErrorCollection.
Dim collection As New ParserErrorCollection()

' Add a ParserError to the collection.
collection.Add(New ParserError("ErrorName", "Path", 1))

' Add an array of ParserError objects to the collection.
Dim errors As ParserError() = _
    {New ParserError("Error 2", "Path", 1), _
    New ParserError("Error 3", "Path", 1)}
collection.AddRange(errors)

' Ads a collection of ParserError objects to the collection.
Dim errorsCollection As New ParserErrorCollection()
errorsCollection.Add(New ParserError("Error", "Path", 1))
errorsCollection.Add(New ParserError("Error", "Path", 1))
collection.AddRange(errorsCollection)

' Test for the presence of a ParserError in the 
' collection, and retrieve its index if it is found.
Dim testError As New ParserError("Error", "Path", 1)
Dim itemIndex As Integer = -1
If collection.Contains(testError) Then
  itemIndex = collection.IndexOf(testError)
End If

' Copy the contents of the collection to a
' compatible array, starting at index 0 of the
' destination array. 
Dim errorsToSort(5) As ParserError
collection.CopyTo(errorsToSort, 0)

' Retrieve the count of the items in the collection.
Dim collectionCount As Integer = collection.Count

' Insert a ParserError at index 0 of the collection.
Dim [error] As New ParserError("Error", "Path", 1)
collection.Insert(0, [error])

' Remove the specified ParserError from the collection.
collection.Remove([error])

' Remove the ParserError at index 0.
collection.RemoveAt(0)

Kommentarer

Klassen ParserErrorCollection innehåller metoder och egenskaper som du kan använda för att hantera en samling ParserError objekt. Du kan till exempel lägga till en uppsättning parserfel i en samling vid parsning när du använder ett anpassat BuildProvider objekt för att rapportera alla parsningsfel som fångas under parsningen.

Använd följande om du vill lägga till parserfel i, ta bort dem från eller leta upp dem i en samling:

Dessutom kan du använda ParserErrorCollection klassen för att göra följande:

Konstruktorer

Name Description
ParserErrorCollection()

Initierar en ny instans av ParserErrorCollection klassen.

ParserErrorCollection(ParserError[])

Initierar en ny instans av ParserErrorCollection klassen.

Egenskaper

Name Description
Capacity

Hämtar eller anger antalet element som CollectionBase kan innehålla.

(Ärvd från CollectionBase)
Count

Hämtar antalet element som finns i instansen CollectionBase . Den här egenskapen kan inte åsidosättas.

(Ärvd från CollectionBase)
InnerList

Hämtar en ArrayList lista med element i instansen CollectionBase .

(Ärvd från CollectionBase)
Item[Int32]

Hämtar eller ställer in objektet ParserError på det angivna indexet i samlingen.

List

Hämtar en IList lista med element i instansen CollectionBase .

(Ärvd från CollectionBase)

Metoder

Name Description
Add(ParserError)

Lägger till ett värde i samlingen.

AddRange(ParserError[])

Lägger till en matris med ParserError objekt i samlingen.

AddRange(ParserErrorCollection)

Lägger till objekten i en befintlig ParserErrorCollection i samlingen.

Clear()

Tar bort alla objekt från instansen CollectionBase . Den här metoden kan inte åsidosättas.

(Ärvd från CollectionBase)
Contains(ParserError)

Avgör om ParserError objektet finns i samlingen.

CopyTo(ParserError[], Int32)

Kopierar objekten ParserError i samlingen till en kompatibel endimensionell matris med början vid det angivna indexet för målmatrisen.

Equals(Object)

Avgör om det angivna objektet är lika med det aktuella objektet.

(Ärvd från Object)
GetEnumerator()

Returnerar en uppräkning som itererar genom instansen CollectionBase .

(Ärvd från CollectionBase)
GetHashCode()

Fungerar som standard-hash-funktion.

(Ärvd från Object)
GetType()

Hämtar den aktuella instansen Type .

(Ärvd från Object)
IndexOf(ParserError)

Hämtar indexet för det angivna ParserError objektet i samlingen.

Insert(Int32, ParserError)

Infogar det angivna ParserError objektet i samlingen vid det angivna indexet.

MemberwiseClone()

Skapar en ytlig kopia av den aktuella Object.

(Ärvd från Object)
OnClear()

Utför ytterligare anpassade processer när du rensar innehållet i instansen CollectionBase .

(Ärvd från CollectionBase)
OnClearComplete()

Utför ytterligare anpassade processer när innehållet i instansen har rensats CollectionBase .

(Ärvd från CollectionBase)
OnInsert(Int32, Object)

Utför ytterligare anpassade processer innan du infogar ett nytt element i instansen CollectionBase .

(Ärvd från CollectionBase)
OnInsertComplete(Int32, Object)

Utför ytterligare anpassade processer när du har infogat ett nytt element i instansen CollectionBase .

(Ärvd från CollectionBase)
OnRemove(Int32, Object)

Utför ytterligare anpassade processer när du tar bort ett element från instansen CollectionBase .

(Ärvd från CollectionBase)
OnRemoveComplete(Int32, Object)

Utför ytterligare anpassade processer när du har tagit bort ett element från instansen CollectionBase .

(Ärvd från CollectionBase)
OnSet(Int32, Object, Object)

Utför ytterligare anpassade processer innan du anger ett värde i instansen CollectionBase .

(Ärvd från CollectionBase)
OnSetComplete(Int32, Object, Object)

Utför ytterligare anpassade processer när du har angett ett värde i instansen CollectionBase .

(Ärvd från CollectionBase)
OnValidate(Object)

Utför ytterligare anpassade processer när du verifierar ett värde.

(Ärvd från CollectionBase)
Remove(ParserError)

Tar bort det angivna ParserError objektet från samlingen.

RemoveAt(Int32)

Tar bort elementet vid det angivna indexet för instansen CollectionBase . Den här metoden kan inte åsidosättas.

(Ärvd från CollectionBase)
ToString()

Returnerar en sträng som representerar det aktuella objektet.

(Ärvd från Object)

Explicita gränssnittsimplementeringar

Name Description
ICollection.CopyTo(Array, Int32)

Kopierar hela CollectionBase till en kompatibel endimensionell Array, med början vid det angivna indexet för målmatrisen.

(Ärvd från CollectionBase)
ICollection.IsSynchronized

Hämtar ett värde som anger om åtkomsten CollectionBase till är synkroniserad (trådsäker).

(Ärvd från CollectionBase)
ICollection.SyncRoot

Hämtar ett objekt som kan användas för att synkronisera åtkomsten CollectionBasetill .

(Ärvd från CollectionBase)
IList.Add(Object)

Lägger till ett objekt i slutet av CollectionBase.

(Ärvd från CollectionBase)
IList.Contains(Object)

Avgör om innehåller CollectionBase ett specifikt element.

(Ärvd från CollectionBase)
IList.IndexOf(Object)

Söker efter den angivna Object och returnerar det nollbaserade indexet för den första förekomsten i hela CollectionBase.

(Ärvd från CollectionBase)
IList.Insert(Int32, Object)

Infogar ett element i CollectionBase det angivna indexet.

(Ärvd från CollectionBase)
IList.IsFixedSize

Hämtar ett värde som anger om har CollectionBase en fast storlek.

(Ärvd från CollectionBase)
IList.IsReadOnly

Hämtar ett värde som anger om är CollectionBase skrivskyddat.

(Ärvd från CollectionBase)
IList.Item[Int32]

Hämtar eller anger elementet vid det angivna indexet.

(Ärvd från CollectionBase)
IList.Remove(Object)

Tar bort den första förekomsten av ett specifikt objekt från CollectionBase.

(Ärvd från CollectionBase)

Tilläggsmetoder

Name Description
AsParallel(IEnumerable)

Möjliggör parallellisering av en fråga.

AsQueryable(IEnumerable)

Konverterar en IEnumerable till en IQueryable.

Cast<TResult>(IEnumerable)

Omvandlar elementen i en IEnumerable till den angivna typen.

OfType<TResult>(IEnumerable)

Filtrerar elementen i en IEnumerable baserat på en angiven typ.

Gäller för

Se även