BasicHttpBinding.CreateBindingElements BasicHttpBinding.CreateBindingElements BasicHttpBinding.CreateBindingElements BasicHttpBinding.CreateBindingElements Method


创建并返回包含当前绑定的绑定元素的有序的集合。Creates and returns an ordered collection of binding elements contained in the current binding.

 override System::ServiceModel::Channels::BindingElementCollection ^ CreateBindingElements();
public override System.ServiceModel.Channels.BindingElementCollection CreateBindingElements ();
override this.CreateBindingElements : unit -> System.ServiceModel.Channels.BindingElementCollection
Public Overrides Function CreateBindingElements () As BindingElementCollection


包含已排序的绑定元素堆栈的 BindingElementCollection,这些绑定元素由 BasicHttpBinding 描述。The BindingElementCollection that contains the ordered stack of binding elements described by the BasicHttpBinding.


下面的示例在当前绑定中创建绑定元素的有序集合。The following example creates an ordered collection of the binding elements in the current binding.

BasicHttpBinding binding = new BasicHttpBinding();
binding.Name = "binding1";
binding.Namespace = "http:\\My.ServiceModel.Samples";
BindingElementCollection elements = binding.CreateBindingElements();


绑定元素的顺序很重要。The order of the binding elements is important. 它反映了构造和堆栈协议以及传输通道的顺序。It reflects the order in which the protocol and transport channels are constructed and stacked. 此绑定元素集合是一个新集合,可以对其进行修改并在之后用于创建 CustomBindingThis collection of binding elements is a new collection and can be modified and then used to create a CustomBinding.