Message.FindPartByName(String) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
搜尋 MessagePartCollection 屬性傳回的 Parts,並傳回具名的 MessagePart。
public:
System::Web::Services::Description::MessagePart ^ FindPartByName(System::String ^ partName);
public System.Web.Services.Description.MessagePart FindPartByName (string partName);
member this.FindPartByName : string -> System.Web.Services.Description.MessagePart
Public Function FindPartByName (partName As String) As MessagePart
參數
- partName
- String
字串,可命名要傳回的 MessagePart。
傳回
例外狀況
集合中沒有指定名稱的 MessagePart。
範例
下列範例示範 FindPartByName
方法的用法。
// Get another message from ServiceDescription.
Message^ myMessage2 = myServiceDescription->Messages[ "DivideHttpGetOut" ];
MessagePart^ myMessagePart = myMessage2->FindPartByName( "Body" );
Console::WriteLine( "Results of FindPartByName operation:" );
Console::WriteLine( "Part Name: {0}", myMessagePart->Name );
Console::WriteLine( "Part Element: {0}", myMessagePart->Element );
// Get another message from ServiceDescription.
Message myMessage2 = myServiceDescription.Messages["DivideHttpGetOut"];
MessagePart myMessagePart=myMessage2.FindPartByName("Body");
Console.WriteLine("Results of FindPartByName operation:");
Console.WriteLine("Part Name: " +myMessagePart.Name);
Console.WriteLine("Part Element: " +myMessagePart.Element);
' Get another message from ServiceDescription.
Dim myMessage2 As Message = myServiceDescription.Messages("DivideHttpGetOut")
Dim myMessagePart As MessagePart = myMessage2.FindPartByName("Body")
Console.WriteLine("Results of FindPartByName operation:")
Console.WriteLine("Part Name: " + myMessagePart.Name)
Console.WriteLine("Part Element: " + myMessagePart.Element.ToString())