Message.FindPartsByName(String[]) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
搜索由 MessagePartCollection 属性返回的 Parts 并返回包含命名实例的 MessagePart 类型的数组。
public:
cli::array <System::Web::Services::Description::MessagePart ^> ^ FindPartsByName(cli::array <System::String ^> ^ partNames);
public System.Web.Services.Description.MessagePart[] FindPartsByName (string[] partNames);
member this.FindPartsByName : string[] -> System.Web.Services.Description.MessagePart[]
Public Function FindPartsByName (partNames As String()) As MessagePart()
参数
- partNames
- String[]
要返回的 MessagePart 实例的名称的数组。
返回
MessagePart 类型的数组。
例外
集合中不存在具有指定名称的 MessagePart 实例。
示例
下面的示例演示 FindPartsByName
方法的用法。
// Get message from ServiceDescription.
Message^ myMessage1 = myServiceDescription->Messages[ "AddHttpPostIn" ];
Console::WriteLine( "ServiceDescription : {0}", myMessage1->ServiceDescription );
array<String^>^myParts = gcnew array<String^>(2);
myParts[ 0 ] = "a";
myParts[ 1 ] = "b";
array<MessagePart^>^myMessageParts = myMessage1->FindPartsByName( myParts );
Console::WriteLine( "Results of FindPartsByName operation:" );
for ( int i = 0; i < myMessageParts->Length; ++i )
{
Console::WriteLine( "Part Name: {0}", myMessageParts[ i ]->Name );
Console::WriteLine( "Part Type: {0}", myMessageParts[ i ]->Type );
}
// Get message from ServiceDescription.
Message myMessage1 = myServiceDescription.Messages["AddHttpPostIn"];
Console.WriteLine("ServiceDescription :"+myMessage1.ServiceDescription);
string[] myParts = new string[2];
myParts[0] = "a";
myParts[1] = "b";
MessagePart[] myMessageParts = myMessage1.FindPartsByName(myParts);
Console.WriteLine("Results of FindPartsByName operation:");
for(int i=0;i<myMessageParts.Length; ++i)
{
Console.WriteLine("Part Name: " +myMessageParts[i].Name);
Console.WriteLine("Part Type: " +myMessageParts[i].Type);
}
' Get message from ServiceDescription.
Dim myMessage1 As Message = myServiceDescription.Messages("AddHttpPostIn")
Console.WriteLine("ServiceDescription :" + _
myMessage1.ServiceDescription.ToString())
Dim myParts(1) As String
myParts(0) = "a"
myParts(1) = "b"
Dim myMessageParts As MessagePart() = myMessage1.FindPartsByName(myParts)
Console.WriteLine("Results of FindPartsByName operation:")
Dim i As Integer
For i = 0 To myMessageParts.Length - 1
Console.WriteLine("Part Name: " + myMessageParts(i).Name)
Console.WriteLine("Part Type: " + myMessageParts(i).Type.ToString())
Next i