次の方法で共有


ServiceDescriptionCollection.Contains メソッド

指定した ServiceDescription がコレクションのメンバかどうかを示す値を返します。

Public Function Contains( _
   ByVal serviceDescription As ServiceDescription _) As Boolean
[C#]
public bool Contains(ServiceDescriptionserviceDescription);
[C++]
public: bool Contains(ServiceDescription* serviceDescription);
[JScript]
public function Contains(
   serviceDescription : ServiceDescription) : Boolean;

パラメータ

  • serviceDescription
    コレクション メンバシップを確認する対象となる ServiceDescription

戻り値

serviceDescription パラメータが ServiceDescriptionCollection のメンバである場合は true 。それ以外の場合は false

使用例

 
' Check for a ServiceDescription in the collection.
If myCollection.Contains(myServiceDescription2) Then
   ' Get the index of a ServiceDescription.
   Dim myIndex As Integer = myCollection.IndexOf(myServiceDescription2)

   ' Remove a ServiceDescription from the collection.
   myCollection.Remove(myServiceDescription2)
   Console.WriteLine("Element at index {0} is removed.", _
      myIndex.ToString())
Else
   Console.WriteLine("Element not found.")
End If

[C#] 
// Check for a ServiceDescription in the collection.
if (myCollection.Contains(myServiceDescription2))
{ 
   // Get the index of a ServiceDescription.
   int myIndex = myCollection.IndexOf(myServiceDescription2);
 
   // Remove a ServiceDescription from the collection.
   myCollection.Remove(myServiceDescription2);
   Console.WriteLine("Element at index {0} is removed.", myIndex);
}
else
{
   Console.WriteLine("Element not found.");
}

[C++] 
// Check for 'ServiceDescription' object in the collection.
if (myCollection->Contains(myServiceDescription2)) 
{
   // Get the index of 'ServiceDescription' object.
   int myIndex = myCollection->IndexOf(myServiceDescription2);
   // Remove 'ServiceDescription' object from the collection.
   myCollection->Remove(myServiceDescription2);
   Console::WriteLine(S"Element at index {0} is removed ",__box( myIndex));
} 
else
   Console::WriteLine(S"Element not found.");

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

ServiceDescriptionCollection クラス | ServiceDescriptionCollection メンバ | System.Web.Services.Description 名前空間