PortTypeCollection.Add(PortType) Método
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Agrega el objeto PortType especificado al final de PortTypeCollection.
public:
int Add(System::Web::Services::Description::PortType ^ portType);
public int Add (System.Web.Services.Description.PortType portType);
member this.Add : System.Web.Services.Description.PortType -> int
Public Function Add (portType As PortType) As Integer
Parámetros
Devoluciones
Índice de base cero en donde se ha agregado el parámetro portType
.
Ejemplos
ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_CS.wsdl" );
PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes;
int noOfPortTypes = myServiceDescription->PortTypes->Count;
Console::WriteLine( "\nTotal number of PortTypes: {0}", myServiceDescription->PortTypes->Count );
// Get the first PortType in the collection.
PortType^ myNewPortType = myPortTypeCollection[ 0 ];
Console::WriteLine( "The PortType at index 0 is: {0}", myNewPortType->Name );
Console::WriteLine( "Removing the PortType {0}", myNewPortType->Name );
// Remove the PortType from the collection.
myPortTypeCollection->Remove( myNewPortType );
// Display the number of PortTypes.
Console::WriteLine( "\nTotal number of PortTypes after removing: {0}", myServiceDescription->PortTypes->Count );
Console::WriteLine( "Adding a PortType {0}", myNewPortType->Name );
// Add a new PortType from the collection.
myPortTypeCollection->Add( myNewPortType );
// Display the number of PortTypes after adding a port.
Console::WriteLine( "Total number of PortTypes after adding a new port: {0}", myServiceDescription->PortTypes->Count );
myServiceDescription->Write( "MathService_New.wsdl" );
ServiceDescription myServiceDescription =
ServiceDescription.Read("MathService_CS.wsdl");
PortTypeCollection myPortTypeCollection =
myServiceDescription.PortTypes;
int noOfPortTypes = myServiceDescription.PortTypes.Count;
Console.WriteLine("\nTotal number of PortTypes: "
+ myServiceDescription.PortTypes.Count);
// Get the first PortType in the collection.
PortType myNewPortType = myPortTypeCollection[0];
Console.WriteLine(
"The PortType at index 0 is: " + myNewPortType.Name);
Console.WriteLine("Removing the PortType " + myNewPortType.Name);
// Remove the PortType from the collection.
myPortTypeCollection.Remove(myNewPortType);
// Display the number of PortTypes.
Console.WriteLine("\nTotal number of PortTypes after removing: "
+ myServiceDescription.PortTypes.Count);
Console.WriteLine("Adding a PortType " + myNewPortType.Name);
// Add a new PortType from the collection.
myPortTypeCollection.Add(myNewPortType);
// Display the number of PortTypes after adding a port.
Console.WriteLine("Total number of PortTypes after " +
"adding a new port: " + myServiceDescription.PortTypes.Count);
myServiceDescription.Write("MathService_New.wsdl");
Dim myServiceDescription As ServiceDescription = _
ServiceDescription.Read("MathService_VB.wsdl")
Dim myPortTypeCollection As PortTypeCollection = _
myServiceDescription.PortTypes
Dim noOfPortTypes As Integer = myServiceDescription.PortTypes.Count
Console.WriteLine( _
ControlChars.Newline & "Total number of PortTypes: " & _
myServiceDescription.PortTypes.Count.ToString())
' Get the first PortType in the collection.
Dim myNewPortType As PortType = myPortTypeCollection(0)
Console.WriteLine( _
"The PortType at index 0 is: " & myNewPortType.Name)
Console.WriteLine("Removing the PortType " & myNewPortType.Name)
' Remove the PortType from the collection.
myPortTypeCollection.Remove(myNewPortType)
' Display the number of PortTypes.
Console.WriteLine(ControlChars.Newline & _
"Total number of PortTypes after removing: " & _
myServiceDescription.PortTypes.Count.ToString())
Console.WriteLine("Adding a PortType " & myNewPortType.Name)
' Add a new PortType from the collection.
myPortTypeCollection.Add(myNewPortType)
' Display the number of PortTypes after adding a port.
Console.WriteLine( _
"Total Number of PortTypes after adding a new port: " & _
myServiceDescription.PortTypes.Count.ToString())
myServiceDescription.Write("MathService_New.wsdl")
Se aplica a
Colaborar con nosotros en GitHub
El origen de este contenido se puede encontrar en GitHub, donde también puede crear y revisar problemas y solicitudes de incorporación de cambios. Para más información, consulte nuestra guía para colaboradores.