指定した CodeExpression がコレクション内に存在する場合は、コレクション内でのそのインデックスを取得します。
Public Function IndexOf( _
ByVal value As CodeExpression _) As Integer
[C#]
public int IndexOf(CodeExpressionvalue);
[C++]
public: int IndexOf(CodeExpression* value);
[JScript]
public function IndexOf(
value : CodeExpression) : int;
パラメータ
- value
コレクション内で検索する CodeExpression 。
戻り値
見つかった場合はコレクション内での指定したオブジェクトのインデックス。それ以外の場合は -1。
使用例
' Tests for the presence of a CodeExpression in the
' collection, and retrieves its index if it is found.
Dim testComment = New CodePrimitiveExpression(True)
Dim itemIndex As Integer = -1
If collection.Contains(testComment) Then
itemIndex = collection.IndexOf(testComment)
End If
[C#]
// Tests for the presence of a CodeExpression in the
// collection, and retrieves its index if it is found.
CodeExpression testComment = new CodePrimitiveExpression(true);
int itemIndex = -1;
if( collection.Contains( testComment ) )
itemIndex = collection.IndexOf( testComment );
[C++]
// Tests for the presence of a CodeExpression in the
// collection, and retrieves its index if it is found.
CodeExpression* testComment = new CodePrimitiveExpression(__box(true));
int itemIndex = -1;
if( collection->Contains( testComment ) )
itemIndex = collection->IndexOf( testComment );
[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 ファミリ
参照
CodeExpressionCollection クラス | CodeExpressionCollection メンバ | System.CodeDom 名前空間 | Contains