共用方式為


ServiceDescriptionFormatExtensionCollection.Contains(Object) 方法

定義

傳回值,指出指定的 ServiceDescriptionFormatExtension 是否為 ServiceDescriptionFormatExtensionCollection 的成員。

public:
 bool Contains(System::Object ^ extension);
public bool Contains (object extension);
member this.Contains : obj -> bool
Public Function Contains (extension As Object) As Boolean

參數

extension
Object

ServiceDescriptionFormatExtension,要為其檢查集合成員資格。

傳回

如果 ServiceDescriptionFormatExtension 是集合的成員,則為 true,否則為 false

範例

// Check for 'myFormatExtension' object in collection.
if ( myCollection->Contains( myFormatExtensionObject ) )
{
   // Get index of a 'myFormatExtension' object in collection.
   Console::WriteLine( "Index of 'myFormatExtensionObject' is {0} in collection.", myCollection->IndexOf( myFormatExtensionObject ) );

   // Remove 'myFormatExtensionObject' element from collection.
   myCollection->Remove( myFormatExtensionObject );
   Console::WriteLine( "'myFormatExtensionObject' is removed  from collection." );
}
// Check for 'myFormatExtension' object in collection.
if(myCollection.Contains(myFormatExtensionObject))
{
   // Get index of a 'myFormatExtension' object in collection.
   Console.WriteLine("Index of 'myFormatExtensionObject' is "+
      "{0} in collection.",
      myCollection.IndexOf(myFormatExtensionObject).ToString());
   // Remove 'myFormatExtensionObject' element from collection.
   myCollection.Remove(myFormatExtensionObject);
   Console.WriteLine("'myFormatExtensionObject' is removed"+
                     " from collection.");
}
' Check for 'myFormatExtension' object in collection.
If myCollection.Contains(myFormatExtensionObject) Then
   ' Get index of a 'myFormatExtension' object in collection.
   Console.WriteLine("Index of 'myFormatExtensionObject' is " + _
        "{0} in collection.", myCollection.IndexOf(myFormatExtensionObject).ToString())
   ' Remove 'myFormatExtensionObject' element from collection.
   myCollection.Remove(myFormatExtensionObject)
   Console.WriteLine("'myFormatExtensionObject' is removed" + _
        " from collection.")
End If

適用於