This documentation is archived and is not being maintained.
PortTypeCollection::Add Method
Visual Studio 2008
Adds the specified PortType to the end of the PortTypeCollection.
Assembly: System.Web.Services (in System.Web.Services.dll)
Parameters
- portType
- Type: System.Web.Services.Description::PortType
The PortType to add to the collection.
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(S"MathService_CS.wsdl");
PortTypeCollection* myPortTypeCollection =
myServiceDescription->PortTypes;
int noOfPortTypes = myServiceDescription->PortTypes->Count;
Console::WriteLine(S"\nTotal number of PortTypes: {0}", __box(myServiceDescription->PortTypes->Count));
// Get the first PortType in the collection.
PortType* myNewPortType = myPortTypeCollection->Item[0];
Console::WriteLine(
S"The PortType at index 0 is: {0}", myNewPortType->Name);
Console::WriteLine(S"Removing the PortType {0}", myNewPortType->Name);
// Remove the PortType from the collection.
myPortTypeCollection->Remove(myNewPortType);
// Display the number of PortTypes.
Console::WriteLine(S"\nTotal number of PortTypes after removing: {0}", __box(myServiceDescription->PortTypes->Count));
Console::WriteLine(S"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(S"Total number of PortTypes after adding a new port: {0}", __box(myServiceDescription->PortTypes->Count));
myServiceDescription->Write(S"MathService_New.wsdl");
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: