CompilerErrorCollection クラス

定義

CompilerError オブジェクトのコレクションを表します。

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

CompilerErrorCollection クラスを使用する方法を次の例に示します。 この例では、 クラスの新しいインスタンスを作成し、いくつかのメソッドを使用してコレクションにステートメントを追加し、そのインデックスを返し、特定のインデックス ポイントで属性を追加または削除します。

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

注釈

CompilerErrorCollection クラスには、一連の CompilerError オブジェクトの格納に使用できる単純なコレクション オブジェクトが用意されています。

注意

このクラスには、すべてのメンバーに適用されるクラス レベルでの継承要求が含まれています。 SecurityException派生クラスに完全信頼アクセス許可がない場合、 がスローされます。 継承要求の詳細については、「 継承要求」を参照してください。

コンストラクター

CompilerErrorCollection()

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

CompilerErrorCollection(CompilerError[])

CompilerErrorCollection オブジェクトの指定した配列を格納する CompilerError の新しいインスタンスを初期化します。

CompilerErrorCollection(CompilerErrorCollection)

指定した CompilerErrorCollection の内容を格納する、CompilerErrorCollection クラスの新しいインスタンスを初期化します。

プロパティ

Capacity

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

(継承元 CollectionBase)
Count

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

(継承元 CollectionBase)
HasErrors

コレクションにエラーが格納されているかどうかを示す値を取得します。

HasWarnings

コレクションに警告が格納されているかどうかを示す値を取得します。

InnerList

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

(継承元 CollectionBase)
Item[Int32]

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

List

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

(継承元 CollectionBase)

メソッド

Add(CompilerError)

指定した CompilerError オブジェクトをエラー コレクションに追加します。

AddRange(CompilerError[])

配列の要素をエラー コレクションの末尾にコピーします。

AddRange(CompilerErrorCollection)

指定したコンパイラ エラー コレクションの内容をエラー コレクションの末尾に追加します。

Clear()

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

(継承元 CollectionBase)
Contains(CompilerError)

指定した CompilerError オブジェクトがコレクションに含まれているかどうかを示す値を取得します。

CopyTo(CompilerError[], Int32)

1 次元の Array インスタンスの指定したインデックス位置に、コレクション値をコピーします。

Equals(Object)

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

(継承元 Object)
GetEnumerator()

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

(継承元 CollectionBase)
GetHashCode()

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

(継承元 Object)
GetType()

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

(継承元 Object)
IndexOf(CompilerError)

指定した CompilerError オブジェクトがコレクション内に存在する場合は、コレクション内でのそのインデックスを取得します。

Insert(Int32, CompilerError)

コレクション内の指定したインデックス位置に、指定した CompilerError を挿入します。

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(CompilerError)

コレクションから特定の CompilerError を削除します。

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 に変換します。

適用対象

こちらもご覧ください