PortTypeCollection.Remove(PortType) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
PortType 内で最初に見つかった指定の PortTypeCollection を削除します。
public:
void Remove(System::Web::Services::Description::PortType ^ portType);
public void Remove (System.Web.Services.Description.PortType portType);
member this.Remove : System.Web.Services.Description.PortType -> unit
Public Sub Remove (portType As PortType)
パラメーター
例
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")
注釈
このメソッドは線形検索を実行します。したがって、平均実行時間は に比例します Count。
削除された PortType 後に続く要素は、空いたスポットを占有するために上に移動します。
適用対象
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
.NET