BindingCollection::Insert Method (Int32, Binding^)
.NET Framework (current version)
Adds the specified Binding to the BindingCollection at the specified zero-based index.
Assembly: System.Web.Services (in System.Web.Services.dll)
Parameters
- index
-
Type:
System::Int32
The zero-based index at which to insert the binding parameter.
- binding
-
Type:
System.Web.Services.Description::Binding^
The Binding to be added to the collection.
If the number of items in the collection already equals the collection's capacity, the capacity is doubled by automatically reallocating the internal array before the new element is inserted.
If the index parameter is equal to Count, the binding parameter is added to the end of the BindingCollection.
The elements after the insertion point move down to accommodate the new element.
// Create a new Binding for SOAP Protocol. Binding^ myBinding = gcnew Binding; myBinding->Name = String::Concat( myServiceDescription->Services->default[ 0 ]->Name, "Soap" ); // Pass the name of the existing porttype 'MathServiceSoap' and the Xml targetNamespace attribute of the Descriptions tag. myBinding->Type = gcnew XmlQualifiedName( "MathServiceSoap",myServiceDescription->TargetNamespace ); // Create SOAP Extensibility element. SoapBinding^ mySoapBinding = gcnew SoapBinding; // SOAP over HTTP. mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; mySoapBinding->Style = SoapBindingStyle::Document; // Add tag soap:binding as an extensibility element. myBinding->Extensions->Add( mySoapBinding ); // Create OperationBindings for each of the operations defined in asmx file. OperationBinding^ addOperationBinding = CreateOperationBinding( "Add", myServiceDescription->TargetNamespace ); myBinding->Operations->Add( addOperationBinding ); OperationBinding^ subtractOperationBinding = CreateOperationBinding( "Subtract", myServiceDescription->TargetNamespace ); myBinding->Operations->Add( subtractOperationBinding ); OperationBinding^ multiplyOperationBinding = CreateOperationBinding( "Multiply", myServiceDescription->TargetNamespace ); myBinding->Operations->Add( multiplyOperationBinding ); OperationBinding^ divideOperationBinding = CreateOperationBinding( "Divide", myServiceDescription->TargetNamespace ); myBinding->Operations->Add( divideOperationBinding ); myServiceDescription->Bindings->Insert( 0, myBinding );
.NET Framework
Available since 1.1
Available since 1.1
Show: