CodeTypeMemberCollection.Contains(CodeTypeMember) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取一个值,该值指示集合是否包含指定的 CodeTypeMember。
public:
bool Contains(System::CodeDom::CodeTypeMember ^ value);
public bool Contains (System.CodeDom.CodeTypeMember value);
member this.Contains : System.CodeDom.CodeTypeMember -> bool
Public Function Contains (value As CodeTypeMember) As Boolean
参数
- value
- CodeTypeMember
要在集合中搜索的 CodeTypeMember。
返回
当集合包含指定的对象时为 true
;否则为 false
。
示例
下面的代码示例使用 Contains 方法搜索特定 CodeTypeMember 对象的存在,并检索找到该对象的索引值。
// Tests for the presence of a CodeTypeMember in the collection,
// and retrieves its index if it is found.
CodeTypeMember^ testMember = gcnew CodeMemberField( "System.String","TestStringField" );
int itemIndex = -1;
if ( collection->Contains( testMember ) )
itemIndex = collection->IndexOf( testMember );
// Tests for the presence of a CodeTypeMember in the collection,
// and retrieves its index if it is found.
CodeTypeMember testMember = new CodeMemberField("System.String", "TestStringField");
int itemIndex = -1;
if( collection.Contains( testMember ) )
itemIndex = collection.IndexOf( testMember );
' Tests for the presence of a CodeTypeMember within the collection, and retrieves its index if it is within the collection.
Dim testMember = New CodeMemberField("System.String", "TestStringField")
Dim itemIndex As Integer = -1
If collection.Contains(testMember) Then
itemIndex = collection.IndexOf(testMember)
End If