共用方式為


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

例外狀況

urlnull

範例

下列程式碼範例會呼叫 Contains 方法,以判斷探索檔是否包含具有變數中 StringUrl 儲存 URL 的成員。

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

適用於

另請參閱