DiscoveryClientDocumentCollection.Contains(String) 方法

定义

确定 DiscoveryClientDocumentCollection 是否包含具有指定 URL 的对象。

public:
 bool Contains(System::String ^ url);
public bool Contains (string url);
member this.Contains : string -> bool
Public Function Contains (url As String) As Boolean

参数

url
String

要在 DiscoveryClientDocumentCollection 内查找的文档的 URL。

返回

如果 DiscoveryClientDocumentCollection 包含具有指定 URL 的对象,则为 true;否则为 false

例外

url 上声明的默认值为 null

示例

下面的代码示例调用 Contains 方法以确定发现文档是否包含一个成员,该成员的 URL 存储在 变量中 StringUrl

bool myContains = myDiscoveryClientDocumentCollection->Contains( myStringUrl );
if ( myContains )
   Console::WriteLine( "The discovery document {0} is present in the  Collection", myStringUrl );
bool myContains = myDiscoveryClientDocumentCollection.Contains(myStringUrl);
if (myContains)
   Console.WriteLine("The discovery document {0} is present in the"
                     + " Collection",myStringUrl);
Dim myContains As Boolean = myDiscoveryClientDocumentCollection.Contains(myStringUrl)
If myContains Then
   Console.WriteLine("The discovery document {0} is present in the Collection", _
                                                                        myStringUrl)
End If

适用于

另请参阅