指定した CompilerError がコレクション内に存在する場合は、そのインデックスを取得します。
Public Function IndexOf( _
ByVal value As CompilerError _) As Integer
[C#]
public int IndexOf(CompilerErrorvalue);
[C++]
public: int IndexOf(CompilerError* value);
[JScript]
public function IndexOf(
value : CompilerError) : int;
パラメータ
- value
検索する CompilerError 。
戻り値
指定した CompilerError が CompilerErrorCollection 内に存在する場合は、そのインデックス。それ以外の場合は -1。
使用例
' 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
[C#]
// 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 );
[C++]
// Tests for the presence of a CompilerError in the
// collection, and retrieves its index if it is found.
CompilerError* testError =
new CompilerError(S"Testfile.cs", 5, 10, S"CS0001", S"Example error text");
int itemIndex = -1;
if (collection->Contains(testError))
itemIndex = collection->IndexOf(testError);
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
CompilerErrorCollection クラス | CompilerErrorCollection メンバ | System.CodeDom.Compiler 名前空間 | Contains