CodeDirectiveCollection.Contains(CodeDirective) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取一个值,该值指示集合是否包含指定的 CodeDirective 对象。
public:
bool Contains(System::CodeDom::CodeDirective ^ value);
public bool Contains (System.CodeDom.CodeDirective value);
member this.Contains : System.CodeDom.CodeDirective -> bool
Public Function Contains (value As CodeDirective) As Boolean
参数
- value
- CodeDirective
要在此集合中搜索的 CodeDirective 对象。
返回
当集合包含指定的对象时为 true
;否则为 false
。
示例
下面的代码示例演示如何使用 Contains 方法来确定集合是否包含特定 CodeDirective 对象。 此示例是为 类提供的更大示例的 CodeDirectiveCollection 一部分。
// Tests for the presence of a CodeDirective in the
// collection, and retrieves its index if it is found.
CodeDirective testDirective = new CodeRegionDirective(CodeRegionMode.Start, "Region1");
int itemIndex = -1;
if (collection.Contains(testDirective))
itemIndex = collection.IndexOf(testDirective);
' Tests for the presence of a CodeDirective in the
' collection, and retrieves its index if it is found.
Dim testDirective = New CodeRegionDirective(CodeRegionMode.Start, "Region1")
Dim itemIndex As Integer = -1
If collection.Contains(testDirective) Then
itemIndex = collection.IndexOf(testDirective)
End If
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈