PortCollection.Remove Method (Port)
.NET Framework (current version)
Removes the first occurrence of the specified Port from the PortCollection.
Assembly: System.Web.Services (in System.Web.Services.dll)
Dim myService As Service Dim myPortCollection As PortCollection Dim myServiceDescription As ServiceDescription = _ ServiceDescription.Read("MathServiceItem_vb.wsdl") Console.WriteLine("Total number of services : " & _ myServiceDescription.Services.Count.ToString) Dim i As Integer For i = 0 to myServiceDescription.Services.Count - 1 myService = myServiceDescription.Services(i) Console.WriteLine("Name : " & myService.Name) myPortCollection = myService.Ports ' Create an array of ports. Console.WriteLine(ControlChars.NewLine & "Port collection :") Dim i1 As Integer For i1 = 0 to myService.Ports.Count - 1 Console.WriteLine("Port[" & i1.ToString & "] : " & _ myPortCollection(i1).Name) Next Dim strPort As String = myPortCollection(0).Name Dim myPort As Port = myPortCollection(strPort) Console.WriteLine(ControlChars.NewLine & _ "Index of Port[" & strPort & "] : " & _ myPortCollection.IndexOf(myPort).ToString) Dim myPortTestRemove As Port = myPortCollection(0) Console.WriteLine(ControlChars.NewLine & _ "Total number of ports before removing " & _ "a port '" & myPortTestRemove.Name & "' is : " & _ myService.Ports.Count.ToString) myPortCollection.Remove(myPortTestRemove) Console.WriteLine("Total number of ports after removing " & _ "a port '" & myPortTestRemove.Name & "' is : " & _ myService.Ports.Count.ToString) ' Create the WSDL file. myPortCollection.Insert(0, myPortTestRemove) myServiceDescription.Write("MathServiceItemNew_vb.wsdl") Next
.NET Framework
Available since 1.1
Available since 1.1
Show: