共用方式為


ServiceDescriptionFormatExtensionCollection.FindAll 方法

定義

搜尋 ServiceDescriptionFormatExtensionCollection 中由傳入的參數指定的集合的所有成員。

多載

FindAll(Type)

搜尋 ServiceDescriptionFormatExtensionCollection,並傳回指定的 Type 的所有元素的陣列。

FindAll(String, String)

搜尋 ServiceDescriptionFormatExtensionCollection,並傳回具有指定名稱和命名空間 URI 的所有成員的陣列。

FindAll(Type)

搜尋 ServiceDescriptionFormatExtensionCollection,並傳回指定的 Type 的所有元素的陣列。

public:
 cli::array <System::Object ^> ^ FindAll(Type ^ type);
public object[] FindAll (Type type);
member this.FindAll : Type -> obj[]
Public Function FindAll (type As Type) As Object()

參數

type
Type

要在集合中搜尋的 Type

傳回

Object[]

Object 執行個體的陣列,表示指定型別的所有集合成員。

範例

// Check all elements of type 'SoapBinding' in collection.
array<Object^>^myObjectArray1 = gcnew array<Object^>(myCollection->Count);
myObjectArray1 = myCollection->FindAll( mySoapBinding1->GetType() );
int myNumberOfElements = 0;
IEnumerator^ myIEnumerator = myObjectArray1->GetEnumerator();

// Calculate number of elements of type 'SoapBinding'.
while ( myIEnumerator->MoveNext() )
      if ( mySoapBinding1->GetType() == myIEnumerator->Current->GetType() )
      myNumberOfElements++;
Console::WriteLine( "Collection contains {0} objects of type ' {1}'.", myNumberOfElements, mySoapBinding1->GetType() );
// Check all elements of type 'SoapBinding' in collection.
Object[] myObjectArray1 = new Object[myCollection.Count];
myObjectArray1 = myCollection.FindAll(mySoapBinding1.GetType());
int myNumberOfElements = 0;
IEnumerator myIEnumerator  = myObjectArray1.GetEnumerator();

// Calculate number of elements of type 'SoapBinding'.
while(myIEnumerator.MoveNext())
{
   if(mySoapBinding1.GetType() == myIEnumerator.Current.GetType())
      myNumberOfElements++;
}
Console.WriteLine("Collection contains {0} objects of type '{1}'.",
                  myNumberOfElements.ToString(),
                  mySoapBinding1.GetType().ToString());
' Check all elements of type 'SoapBinding' in collection.
Dim myObjectArray1(myCollection.Count -1 ) As Object
myObjectArray1 = myCollection.FindAll(mySoapBinding1.GetType())
Dim myNumberOfElements As Integer = 0
Dim myIEnumerator As IEnumerator = myObjectArray1.GetEnumerator()

' Calculate number of elements of type 'SoapBinding'.
While myIEnumerator.MoveNext()
   If mySoapBinding1.GetType() Is  myIEnumerator.Current.GetType() Then
      myNumberOfElements += 1
   End If
End While
Console.WriteLine("Collection contains {0} objects of type '{1}'.", _
        myNumberOfElements.ToString(), mySoapBinding1.GetType().ToString())

備註

注意

如果搜尋失敗,則傳回的陣列是空的。

適用於

FindAll(String, String)

搜尋 ServiceDescriptionFormatExtensionCollection,並傳回具有指定名稱和命名空間 URI 的所有成員的陣列。

public:
 cli::array <System::Xml::XmlElement ^> ^ FindAll(System::String ^ name, System::String ^ ns);
public System.Xml.XmlElement[] FindAll (string name, string ns);
member this.FindAll : string * string -> System.Xml.XmlElement[]
Public Function FindAll (name As String, ns As String) As XmlElement()

參數

name
String

要尋找的 XmlElement 物件的 XML 名稱屬性 (Attribute)。

ns
String

要尋找的 XmlElement 物件的 XML 命名空間 URI 屬性。

傳回

XmlElement[]

XmlElement 執行個體的陣列。

備註

注意

如果搜尋失敗,則傳回的陣列是空的。

適用於