次の方法で共有


BasicHttpBinding.CreateBindingElements Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Returns an ordered collection of binding elements contained in the current binding.

Namespace:  System.ServiceModel
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

Syntax

'Declaration
Public Overrides Function CreateBindingElements As BindingElementCollection
public override BindingElementCollection CreateBindingElements()

Return Value

Type: System.ServiceModel.Channels.BindingElementCollection
The BindingElementCollection that contains the ordered stack of binding elements described by the BasicHttpBinding.

Remarks

The order of the binding elements is important. It reflects the order in which the protocol and transport channels are constructed and stacked. This collection of binding elements creates a new collection each time it is called and can be modified and then used to create a CustomBinding.

Examples

            Dim basicEHBinding As New BasicHttpBinding()
            Dim bindingEC As BindingElementCollection = basicEHBinding.CreateBindingElements()
            'Check on binding elements contained in the collection
            Dim boolHTBE As Boolean = bindingEC.Contains(GetType(HttpTransportBindingElement))
            'Returns true
            Dim txtboolHTBE As String = boolHTBE.ToString()
            Dim boolHSTBE As Boolean = bindingEC.Contains(GetType(HttpsTransportBindingElement))
            'Returns false
            Dim txtboolHSTBE As String = boolHSTBE.ToString()
BasicHttpBinding basicEHBinding = new BasicHttpBinding();
BindingElementCollection bindingEC = basicEHBinding.CreateBindingElements();
//Check on binding elements contained in the collection
bool boolHTBE = bindingEC.Contains(typeof(HttpTransportBindingElement));
//Returns true
string txtboolHTBE = boolHTBE.ToString();
bool boolHSTBE = bindingEC.Contains(typeof(HttpsTransportBindingElement));
//Returns false
string txtboolHSTBE = boolHSTBE.ToString();

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.