語言

ServiceDescriptionCollection 類別

定義

代表類別的 ServiceDescription 一組實例。 此類別無法獲得繼承。

public ref class ServiceDescriptionCollection sealed : System::Web::Services::Description::ServiceDescriptionBaseCollection
public sealed class ServiceDescriptionCollection : System.Web.Services.Description.ServiceDescriptionBaseCollection
type ServiceDescriptionCollection = class
    inherit ServiceDescriptionBaseCollection
Public NotInheritable Class ServiceDescriptionCollection
Inherits ServiceDescriptionBaseCollection
繼承

範例

#using <System.Web.Services.dll>
#using <System.Xml.dll>

using namespace System;
using namespace System::Xml;
using namespace System::Web::Services::Description;

int main()
{
   try
   {
      // Get ServiceDescription objects.
      ServiceDescription^ myServiceDescription1 = ServiceDescription::Read( "DataTypes_cpp.wsdl" );
      ServiceDescription^ myServiceDescription2 = ServiceDescription::Read( "MathService_cpp.wsdl" );

      // Set the names of the ServiceDescriptions.
      myServiceDescription1->Name = "DataTypes";
      myServiceDescription2->Name = "MathService";

      // Create a ServiceDescriptionCollection.
      ServiceDescriptionCollection^ myServiceDescriptionCollection = gcnew ServiceDescriptionCollection;

      // Add the ServiceDescriptions to the collection.
      myServiceDescriptionCollection->Add( myServiceDescription1 );
      myServiceDescriptionCollection->Add( myServiceDescription2 );

      // Display the elements of the collection using the Item property.
      Console::WriteLine( "Elements in the collection: " );
      for ( int i = 0; i < myServiceDescriptionCollection->Count; i++ )
         Console::WriteLine( myServiceDescriptionCollection[ i ]->Name );

      // Construct an XML qualified name.
      XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "MathServiceSoap","http://tempuri2.org/" );

      // Get the Binding from the collection.
      Binding^ myBinding = myServiceDescriptionCollection->GetBinding( myXmlQualifiedName );
      Console::WriteLine( "Binding found in collection with name: {0}", myBinding->ServiceDescription->Name );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "The following exception was raised: {0}", e->Message );
   }
}
using System;
using System.Xml;
using System.Web.Services.Description;

class MyServiceDescriptionCollection
{
   public static void Main()
   {
      try
      {
         // Get ServiceDescription objects.
         ServiceDescription myServiceDescription1 =
            ServiceDescription.Read("DataTypes_CS.wsdl");
         ServiceDescription myServiceDescription2 =
            ServiceDescription.Read("MathService_CS.wsdl");

         // Set the names of the ServiceDescriptions.
         myServiceDescription1.Name = "DataTypes";
         myServiceDescription2.Name = "MathService";

         // Create a ServiceDescriptionCollection.
         ServiceDescriptionCollection myServiceDescriptionCollection =
            new ServiceDescriptionCollection();

         // Add the ServiceDescriptions to the collection.
         myServiceDescriptionCollection.Add(myServiceDescription1);
         myServiceDescriptionCollection.Add(myServiceDescription2);

         // Display the elements of the collection using the indexer.
         Console.WriteLine("Elements in the collection: ");
         for(int i = 0; i < myServiceDescriptionCollection.Count; i++)
         {
            Console.WriteLine(myServiceDescriptionCollection[i].Name);
         }

         // Construct an XML qualified name.
         XmlQualifiedName myXmlQualifiedName =
            new XmlQualifiedName("MathServiceSoap", "http://tempuri2.org/");

         // Get the Binding from the collection.
         Binding myBinding =
            myServiceDescriptionCollection.GetBinding(myXmlQualifiedName);

         Console.WriteLine("Binding found in collection with name: " +
                           myBinding.ServiceDescription.Name);
      }
      catch(Exception e)
      {
         Console.WriteLine("The following exception was raised: {0}", e.Message);
      }
   }
}
Imports System.Xml
Imports System.Web.Services.Description

Class MyServiceDescriptionCollection
   
   Public Shared Sub Main()
      Try
         ' Get ServiceDescription objects.
         Dim myServiceDescription1 As ServiceDescription = _
            ServiceDescription.Read("DataTypes_VB.wsdl")
         Dim myServiceDescription2 As ServiceDescription = _
            ServiceDescription.Read("MathService_VB.wsdl")

         ' Set the names of the ServiceDescriptions.
         myServiceDescription1.Name = "DataTypes"
         myServiceDescription2.Name = "MathService"
         
         ' Create a ServiceDescriptionCollection.
         Dim myServiceDescriptionCollection As _
            New ServiceDescriptionCollection()
         
         ' Add the ServiceDescriptions to the collection. 
         myServiceDescriptionCollection.Add(myServiceDescription1)
         myServiceDescriptionCollection.Add(myServiceDescription2)
         
         ' Display the elements of the collection using the Item property.
         Console.WriteLine("Elements in the collection: ")
         Dim i As Integer
         For i = 0 To myServiceDescriptionCollection.Count - 1
            Console.WriteLine(myServiceDescriptionCollection(i).Name)
         Next i

         ' Construct an XML qualified name.
         Dim myXmlQualifiedName As New XmlQualifiedName( _
            "MathServiceSoap", "http://tempuri2.org/")
         
         ' Get the Binding from the collection.
         Dim myBinding As Binding =  _
            myServiceDescriptionCollection.GetBinding(myXmlQualifiedName)
         
         Console.WriteLine("Binding found in collection with name: " &  _
            myBinding.ServiceDescription.Name)
      Catch e As Exception
         Console.WriteLine("The following exception was raised: {0}", _
                 e.Message.ToString())
      End Try
   End Sub
End Class

建構函式

名稱 Description
ServiceDescriptionCollection()

初始化 ServiceDescriptionCollection 類別的新執行個體。

屬性

名稱 Description
Capacity

取得或設定 CollectionBase 可以包含的項目數目。

(繼承來源 CollectionBase)
Count

取得該實例中包含 CollectionBase 的元素數量。 此屬性無法覆寫。

(繼承來源 CollectionBase)
InnerList

取得包含實ArrayList例中元素清單的 。CollectionBase

(繼承來源 CollectionBase)
Item[Int32]

取得或設定 a ServiceDescription 在指定的零基索引值。

Item[String]

會根據其ServiceDescription性質獲得 指定。TargetNamespace

List

取得包含實IList例中元素清單的 。CollectionBase

(繼承來源 CollectionBase)
Table

獲得一個介面,實現鍵與值 ServiceDescriptionBaseCollection在 中的關聯。

(繼承來源 ServiceDescriptionBaseCollection)

方法

名稱 Description
Add(ServiceDescription)

將指定的 ServiceDescription 加入 的末尾 ServiceDescriptionCollection。

Clear()

移除實例中 CollectionBase 的所有物件。 此方法無法被覆蓋。

(繼承來源 CollectionBase)
Contains(ServiceDescription)

回傳一個值,表示指定的 ServiceDescription 是否屬於集合。

CopyTo(ServiceDescription[], Int32)

將整個 ServiceDescriptionCollection 資料複製到一維陣 ServiceDescription列,型為 ,從目標陣列指定的零基索引開始。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetBinding(XmlQualifiedName)

搜尋 並 ServiceDescriptionCollection 回傳指定名稱的 , Binding 該名稱是集合中某 ServiceDescription 個實例的成員。

GetEnumerator()

回傳一個枚舉器,會遍歷該 CollectionBase 實例。

(繼承來源 CollectionBase)
GetHashCode()

做為預設哈希函式。

(繼承來源 Object)
GetKey(Object)

回傳與引用傳遞值相關的鍵名稱。

(繼承來源 ServiceDescriptionBaseCollection)
GetMessage(XmlQualifiedName)

搜尋 並 ServiceDescriptionCollection 回傳指定名稱的 , Message 該名稱是集合中某 ServiceDescription 個實例的成員。

GetPortType(XmlQualifiedName)

搜尋 並 ServiceDescriptionCollection 回傳指定名稱的 , PortType 該名稱是集合中某 ServiceDescription 個實例的成員。

GetService(XmlQualifiedName)

搜尋 並 ServiceDescriptionCollection 回傳指定名稱的 , Service 該名稱是集合中某 ServiceDescription 個實例的成員。

GetType()

取得目前實例的 Type。

(繼承來源 Object)
IndexOf(ServiceDescription)

搜尋指定的 ServiceDescription 索引,並回傳集合中首次出現的零為基礎索引。

Insert(Int32, ServiceDescription)

將指定的 ServiceDescription 實例加入 ServiceDescriptionCollection 指定的零基索引。

MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
OnClear()

清除實例內容 ServiceDescriptionBaseCollection 。

(繼承來源 ServiceDescriptionBaseCollection)
OnClearComplete()

清除實例內容 CollectionBase 後,執行額外的自訂程序。

(繼承來源 CollectionBase)
OnInsert(Int32, Object)

在插入新元素前 CollectionBase ,執行額外的自訂程序。

(繼承來源 CollectionBase)
OnInsertComplete(Int32, Object)

在插入新元素後執行額外的自訂程序。ServiceDescriptionBaseCollection

(繼承來源 ServiceDescriptionBaseCollection)
OnRemove(Int32, Object)

從 中移除一個元素。ServiceDescriptionBaseCollection

(繼承來源 ServiceDescriptionBaseCollection)
OnRemoveComplete(Int32, Object)

移除實 CollectionBase 例元素後,執行額外的自訂程序。

(繼承來源 CollectionBase)
OnSet(Int32, Object, Object)

在 中替換一個值為另一個 ServiceDescriptionBaseCollection。

(繼承來源 ServiceDescriptionBaseCollection)
OnSetComplete(Int32, Object, Object)

在實例設定值 CollectionBase 後,執行額外的自訂程序。

(繼承來源 CollectionBase)
OnValidate(Object)

在驗證值時執行額外的自訂流程。

(繼承來源 CollectionBase)
Remove(ServiceDescription)

移除該集合 ServiceDescription 中指定的首次出現。

RemoveAt(Int32)

移除實例指定索引 CollectionBase 的元素。 此方法無法被覆蓋。

(繼承來源 CollectionBase)
SetParent(Object, Object)

設定該實例的 ServiceDescriptionBaseCollection 父物件。

(繼承來源 ServiceDescriptionBaseCollection)
ToString()

傳回表示目前 物件的字串。

(繼承來源 Object)

明確介面實作

名稱 Description
ICollection.CopyTo(Array, Int32)

從目標陣列的指定索引開始,將整個 CollectionBase 複製到相容的一維 Array。

(繼承來源 CollectionBase)
ICollection.IsSynchronized

取得值,指出是否同步存取 CollectionBase (線程安全)。

(繼承來源 CollectionBase)
ICollection.SyncRoot

取得一個物件,可用來同步存取 CollectionBase。

(繼承來源 CollectionBase)
IList.Add(Object)

將物件加入至 CollectionBase的結尾。

(繼承來源 CollectionBase)
IList.Contains(Object)

判斷是否 CollectionBase 包含特定元素。

(繼承來源 CollectionBase)
IList.IndexOf(Object)

搜尋指定的 Object,並傳回整個 CollectionBase內第一個出現專案的以零起始的索引。

(繼承來源 CollectionBase)
IList.Insert(Int32, Object)

將專案插入指定索引處的 CollectionBase。

(繼承來源 CollectionBase)
IList.IsFixedSize

取得值,指出 CollectionBase 是否有固定大小。

(繼承來源 CollectionBase)
IList.IsReadOnly

取得值,指出 CollectionBase 是否為唯讀。

(繼承來源 CollectionBase)
IList.Item[Int32]

取得或設定位於指定索引處的專案。

(繼承來源 CollectionBase)
IList.Remove(Object)

從 CollectionBase移除第一個出現的特定物件。

(繼承來源 CollectionBase)

擴充方法

名稱 Description
AsParallel(IEnumerable)

啟用查詢的平行處理。

AsQueryable(IEnumerable)

將 IEnumerable 轉換成 IQueryable。

Cast<TResult>(IEnumerable)

將 IEnumerable 的項目轉換成指定的型別。

OfType<TResult>(IEnumerable)

根據指定的型別篩選 IEnumerable 的專案。

適用於