CodeTypeReferenceCollection.IndexOf(CodeTypeReference) 方法

定義

若該集合中存在,則取得指定 CodeTypeReference集合中的索引。

public:
 int IndexOf(System::CodeDom::CodeTypeReference ^ value);
public int IndexOf(System.CodeDom.CodeTypeReference value);
member this.IndexOf : System.CodeDom.CodeTypeReference -> int
Public Function IndexOf (value As CodeTypeReference) As Integer

參數

value
CodeTypeReference

在收藏中尋找。CodeTypeReference

傳回

若找到集合中指定的 CodeTypeReference 索引;否則為 -1。

範例

// Tests for the presence of a CodeTypeReference in the
// collection, and retrieves its index if it is found.
CodeTypeReference testReference = new CodeTypeReference(typeof(bool));
int itemIndex = -1;
if( collection.Contains( testReference ) )
    itemIndex = collection.IndexOf( testReference );
' Tests for the presence of a CodeTypeReference in the 
' collection, and retrieves its index if it is found.
Dim testReference As New CodeTypeReference(GetType(Boolean))
Dim itemIndex As Integer = -1
If collection.Contains(testReference) Then
    itemIndex = collection.IndexOf(testReference)
End If

適用於

另請參閱