This documentation is archived and is not being maintained.
BindingCollection.Add Method
.NET Framework 1.1
Adds the specified Binding to the end of the BindingCollection.
[Visual Basic] Public Function Add( _ ByVal binding As Binding _ ) As Integer [C#] public int Add( Binding binding ); [C++] public: int Add( Binding* binding ); [JScript] public function Add( binding : Binding ) : int;
Parameters
- binding
- The Binding to add to the collection.
Return Value
The zero-based index where the binding parameter has been added.
Example
[Visual Basic] Dim myServiceDescription As ServiceDescription = ServiceDescription.Read("MathService_input.wsdl") Console.WriteLine(("Total Number of bindings defined are:" + myServiceDescription.Bindings.Count.ToString())) myBinding = myServiceDescription.Bindings(0) ' Remove the first binding in the collection. myServiceDescription.Bindings.Remove(myBinding) Console.WriteLine(("Successfully removed binding " + myBinding.Name)) Console.WriteLine(("Total Number of bindings defined now are:" + myServiceDescription.Bindings.Count.ToString())) myServiceDescription.Write("MathService_temp.wsdl") ' Add binding to the ServiceDescription instance. myServiceDescription.Bindings.Add(myBinding) [C#] ServiceDescription myServiceDescription = ServiceDescription.Read("MathService_input.wsdl"); Console.WriteLine("Total Number of bindings defined are:" + myServiceDescription.Bindings.Count); myBinding = myServiceDescription.Bindings[0]; // Remove the first binding in the collection. myServiceDescription.Bindings.Remove(myBinding); Console.WriteLine("Successfully removed binding " + myBinding.Name); Console.WriteLine("Total Number of bindings defined now are:" + myServiceDescription.Bindings.Count); myServiceDescription.Write("MathService_temp.wsdl"); // Add binding to the ServiceDescription instance. myServiceDescription.Bindings.Add(myBinding); [C++] ServiceDescription * myServiceDescription = ServiceDescription::Read(S"MathService_input.wsdl"); Console::WriteLine(S"Total Number of bindings defined are: {0}", __box(myServiceDescription -> Bindings->Count)); myBinding = myServiceDescription -> Bindings->Item[0]; // Remove the first binding in the collection. myServiceDescription -> Bindings -> Remove(myBinding); Console::WriteLine(S"Successfully removed binding {0}", myBinding -> Name); Console::WriteLine(S"Total Number of bindings defined now are: {0}", __box(myServiceDescription -> Bindings->Count)); myServiceDescription -> Write(S"MathService_temp.wsdl"); // Add binding to the ServiceDescription instance. myServiceDescription -> Bindings->Add(myBinding);
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also
BindingCollection Class | BindingCollection Members | System.Web.Services.Description Namespace
Show: