ParserErrorCollection クラス

定義

解析中に検出された一連のパーサー エラーを管理します。 このクラスは継承できません。

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
継承
ParserErrorCollection
属性

次のコード例では、 メソッドの使用方法を ParserErrorCollection 示します。

// 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)

注釈

クラスには ParserErrorCollection 、オブジェクトのコレクション ParserError を管理するために使用できるメソッドとプロパティが用意されています。 たとえば、解析時にカスタム BuildProvider オブジェクトを使用して、解析中にキャッチされたすべての解析例外を報告するときに、一連のパーサー エラーをコレクションに追加できます。

パーサー エラーの追加、コレクションからの削除、またはコレクション内での検索を行う場合は、次を使用します。

  • Add 1 つのParserErrorオブジェクトをコレクションに追加するメソッド。

  • AddRangeコレクションに複数ParserErrorのオブジェクトを追加するメソッド。

  • Insertメソッドとプロパティ (Item[]インデクサー) のParserErrorCollection両方で、指定したインデックス位置のコレクションに単一ParserErrorのオブジェクトを追加します。

さらに、 クラスを ParserErrorCollection 使用して、次の操作を行うことができます。

  • メソッドを使用してオブジェクトをRemove削除ParserErrorします。

  • メソッドを使用して、特定 ParserError の がコレクション内にあるかどうかを確認します Contains

  • メソッドを使用して、 ParserError コレクション内のオブジェクトの場所を IndexOf 検索します。

コンストラクター

ParserErrorCollection()

ParserErrorCollection クラスの新しいインスタンスを初期化します。

ParserErrorCollection(ParserError[])

ParserErrorCollection クラスの新しいインスタンスを初期化します。

プロパティ

Capacity

CollectionBase に格納できる要素の数を取得または設定します。

(継承元 CollectionBase)
Count

CollectionBase インスタンスに含まれる要素の数を取得します。 このプロパティはオーバーライドできません。

(継承元 CollectionBase)
InnerList

ArrayList インスタンス内の要素のリストを格納する CollectionBase を取得します。

(継承元 CollectionBase)
Item[Int32]

コレクション内の指定したインデックス位置にある ParserError オブジェクトを取得または設定します。

List

IList インスタンス内の要素のリストを格納する CollectionBase を取得します。

(継承元 CollectionBase)

メソッド

Add(ParserError)

値をコレクションに追加します。

AddRange(ParserError[])

コレクションに ParserError オブジェクトの配列を追加します。

AddRange(ParserErrorCollection)

既存の ParserErrorCollection 内のオブジェクトをコレクションに追加します。

Clear()

CollectionBase インスタンスからすべてのオブジェクトを削除します。 このメソッドはオーバーライドできません。

(継承元 CollectionBase)
Contains(ParserError)

ParserError オブジェクトがコレクション内にあるかどうかを判断します。

CopyTo(ParserError[], Int32)

コピー先配列の指定されたインデックスを開始位置として、コレクション内の ParserError オブジェクトを互換性がある 1 次元配列にコピーします。

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetEnumerator()

CollectionBase インスタンスを反復処理する列挙子を返します。

(継承元 CollectionBase)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
IndexOf(ParserError)

コレクション内の指定した ParserError オブジェクトのインデックスを取得します。

Insert(Int32, ParserError)

このコレクション内の指定したインデックス位置に、指定した ParserError オブジェクトを挿入します。

MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
OnClear()

CollectionBase インスタンスの内容を消去しているときに、追加のカスタム プロセスを実行します。

(継承元 CollectionBase)
OnClearComplete()

CollectionBase インスタンスの内容を消去した後に、追加のカスタム プロセスを実行します。

(継承元 CollectionBase)
OnInsert(Int32, Object)

CollectionBase インスタンスに新しい要素を挿入する前に、追加のカスタム プロセスを実行します。

(継承元 CollectionBase)
OnInsertComplete(Int32, Object)

CollectionBase インスタンスに新しい要素を挿入した後に、追加のカスタム プロセスを実行します。

(継承元 CollectionBase)
OnRemove(Int32, Object)

CollectionBase インスタンスから要素を削除するときに、追加のカスタム プロセスを実行します。

(継承元 CollectionBase)
OnRemoveComplete(Int32, Object)

CollectionBase インスタンスから要素を削除した後に、追加のカスタム プロセスを実行します。

(継承元 CollectionBase)
OnSet(Int32, Object, Object)

CollectionBase インスタンスに値を設定する前に、追加のカスタム プロセスを実行します。

(継承元 CollectionBase)
OnSetComplete(Int32, Object, Object)

CollectionBase インスタンスに値を設定した後に、追加のカスタム プロセスを実行します。

(継承元 CollectionBase)
OnValidate(Object)

値を検証するときに、追加のカスタム プロセスを実行します。

(継承元 CollectionBase)
Remove(ParserError)

指定した ParserError オブジェクトをコレクションから削除します。

RemoveAt(Int32)

CollectionBase インスタンスの指定したインデックスにある要素を削除します。 このメソッドはオーバーライドできません。

(継承元 CollectionBase)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

明示的なインターフェイスの実装

ICollection.CopyTo(Array, Int32)

CollectionBase 全体を互換性のある 1 次元の Array にコピーします。コピー操作は、コピー先の配列の指定したインデックスから始まります。

(継承元 CollectionBase)
ICollection.IsSynchronized

CollectionBase へのアクセスが同期されている (スレッド セーフである) かどうかを示す値を取得します。

(継承元 CollectionBase)
ICollection.SyncRoot

CollectionBase へのアクセスを同期するために使用できるオブジェクトを取得します。

(継承元 CollectionBase)
IList.Add(Object)

CollectionBase の末尾にオブジェクトを追加します。

(継承元 CollectionBase)
IList.Contains(Object)

CollectionBase に特定の要素が格納されているかどうかを判断します。

(継承元 CollectionBase)
IList.IndexOf(Object)

指定した Object を検索し、CollectionBase 全体内で最初に見つかった位置の 0 から始まるインデックスを返します。

(継承元 CollectionBase)
IList.Insert(Int32, Object)

CollectionBase 内の指定したインデックスの位置に要素を挿入します。

(継承元 CollectionBase)
IList.IsFixedSize

CollectionBase が固定サイズかどうかを示す値を取得します。

(継承元 CollectionBase)
IList.IsReadOnly

CollectionBase が読み取り専用かどうかを示す値を取得します。

(継承元 CollectionBase)
IList.Item[Int32]

指定したインデックスにある要素を取得または設定します。

(継承元 CollectionBase)
IList.Remove(Object)

特定のオブジェクトが CollectionBase 内にあるときに、最初に出現したものを削除します。

(継承元 CollectionBase)

拡張メソッド

Cast<TResult>(IEnumerable)

IEnumerable の要素を、指定した型にキャストします。

OfType<TResult>(IEnumerable)

指定された型に基づいて IEnumerable の要素をフィルター処理します。

AsParallel(IEnumerable)

クエリの並列化を有効にします。

AsQueryable(IEnumerable)

IEnumerableIQueryable に変換します。

適用対象

こちらもご覧ください