Share via


ServiceDescription 建構函式

定義

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

多載

ServiceDescription()

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

ServiceDescription(IEnumerable<ServiceEndpoint>)

從服務端點的指定列舉型別,初始化 ServiceDescription 類別的新執行個體。

ServiceDescription()

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

public:
 ServiceDescription();
public ServiceDescription ();
Public Sub New ()

範例

// Use Default constructor
ServiceDescription sd = new ServiceDescription();
' Use Default constructor
Dim sd As New ServiceDescription()

適用於

ServiceDescription(IEnumerable<ServiceEndpoint>)

從服務端點的指定列舉型別,初始化 ServiceDescription 類別的新執行個體。

public:
 ServiceDescription(System::Collections::Generic::IEnumerable<System::ServiceModel::Description::ServiceEndpoint ^> ^ endpoints);
public ServiceDescription (System.Collections.Generic.IEnumerable<System.ServiceModel.Description.ServiceEndpoint> endpoints);
new System.ServiceModel.Description.ServiceDescription : seq<System.ServiceModel.Description.ServiceEndpoint> -> System.ServiceModel.Description.ServiceDescription
Public Sub New (endpoints As IEnumerable(Of ServiceEndpoint))

參數

endpoints
IEnumerable<ServiceEndpoint>

用於初始化服務描述的型別 IEnumerable<T>ServiceEndpoint

例外狀況

endpointsnull

範例

// Create ServiceDescription from a collection of service endpoints
List<ServiceEndpoint> endpoints = new List<ServiceEndpoint>();
ContractDescription conDescr = new ContractDescription("ICalculator");
EndpointAddress endpointAddress = new EndpointAddress("http://localhost:8001/Basic");
ServiceEndpoint ep = new ServiceEndpoint(conDescr, new BasicHttpBinding(), endpointAddress);
endpoints.Add(ep);
ServiceDescription sd2 = new ServiceDescription(endpoints);
' Create ServiceDescription from a collection of service endpoints
Dim endpoints As New List(Of ServiceEndpoint)()
Dim conDescr As New ContractDescription("ICalculator")
Dim endpointAddress As New EndpointAddress("http://localhost:8001/Basic")
Dim ep As New ServiceEndpoint(conDescr, New BasicHttpBinding(), endpointAddress)
endpoints.Add(ep)
Dim sd2 As New ServiceDescription(endpoints)

適用於