다음을 통해 공유


MessagePartCollection.Remove(MessagePart) 메서드

정의

MessagePart에서 맨 처음 발견되는 지정된 MessagePartCollection을 제거합니다.

public:
 void Remove(System::Web::Services::Description::MessagePart ^ messagePart);
public void Remove (System.Web.Services.Description.MessagePart messagePart);
member this.Remove : System.Web.Services.Description.MessagePart -> unit
Public Sub Remove (messagePart As MessagePart)

매개 변수

messagePart
MessagePart

컬렉션에서 제거할 MessagePart입니다.

예제

다음 예제에서는 Remove 메서드를 사용하는 방법을 보여 줍니다.

Console::WriteLine( "Checking if message is AddHttpPostOut..." );
Message^ myMessage = myServiceDescription->Messages[ "AddHttpPostOut" ];
if ( myMessageCollection->Contains( myMessage ) )
{
   // Get the mssage part collection.
   MessagePartCollection^ myMessagePartCollection = myMessage->Parts;

   // Get the part named Body.
   MessagePart^ myMessagePart = myMessage->Parts[ "Body" ];
   if ( myMessagePartCollection->Contains( myMessagePart ) )
   {
      // Get the part named Body.
      Console::WriteLine( "Index of Body in MessagePart collection = {0}", myMessagePartCollection->IndexOf( myMessagePart ) );
      Console::WriteLine( "Deleting Body from MessagePart collection..." );
      myMessagePartCollection->Remove( myMessagePart );
      if ( myMessagePartCollection->IndexOf( myMessagePart ) == -1 )
               Console::WriteLine( "from the message AddHttpPostOut." );
   }
}
Console.WriteLine("Checking if message is AddHttpPostOut...");
Message myMessage = myServiceDescription.Messages["AddHttpPostOut"];
if (myMessageCollection.Contains(myMessage))
{
   // Get the message part collection.
   MessagePartCollection myMessagePartCollection = myMessage.Parts;

   // Get the part named Body.
   MessagePart myMessagePart = myMessage.Parts["Body"];
   if (myMessagePartCollection.Contains(myMessagePart))
   {
      // Get the index of the part named Body.
      Console.WriteLine("Index of Body in MessagePart collection = " +
         myMessagePartCollection.IndexOf(myMessagePart));
      Console.WriteLine("Deleting Body from MessagePart collection...");
      myMessagePartCollection.Remove(myMessagePart);
      if(myMessagePartCollection.IndexOf(myMessagePart)== -1)
      {
         Console.WriteLine("MessagePart Body successfully deleted " +
            "from the message AddHttpPostOut.");
      }
   }
}
Console.WriteLine("Checking if message is AddHttpPostOut...")
Dim myMessage As Message = myServiceDescription.Messages("AddHttpPostOut")
If myMessageCollection.Contains(myMessage) Then

   ' Get the message part collection.
   Dim myMessagePartCollection As MessagePartCollection = myMessage.Parts

   ' Get the part named Body.
   Dim myMessagePart As MessagePart = myMessage.Parts("Body")
   If myMessagePartCollection.Contains(myMessagePart) Then

      ' Get the index of the part named Body.
      Console.WriteLine("Index of Body in MessagePart collection = " & _
         myMessagePartCollection.IndexOf(myMessagePart).ToString)
      Console.WriteLine("Deleting Body from MessagePart Collection...")
      myMessagePartCollection.Remove(myMessagePart)
      If myMessagePartCollection.IndexOf(myMessagePart) = -1 Then
         Console.WriteLine("MessagePart Body successfully deleted " & _
         "from the message AddHttpPostOut.")
      End If
   End If
End If

설명

이 메서드는; 선형 검색을 수행합니다. 따라서 평균 실행 시간에 비례 Count합니다.

제거 된 다음에 오는 요소 MessagePart 위로 이동 하 여 빈된 지점을 차지 합니다.

적용 대상