次の方法で共有


MessagePartCollection.Item[] プロパティ

定義

渡されたパラメーターによって指定された MessagePart の値を取得または設定します。

オーバーロード

Item[Int32]

指定の 0 から始まるインデックス番号に対応する MessagePart の値を取得または設定します。

Item[String]

名前で指定された MessagePart を取得します。

Item[Int32]

ソース:
ServiceDescription.cs
ソース:
ServiceDescription.cs
ソース:
ServiceDescription.cs

指定の 0 から始まるインデックス番号に対応する MessagePart の値を取得または設定します。

public:
 property System::Web::Services::Description::MessagePart ^ default[int] { System::Web::Services::Description::MessagePart ^ get(int index); void set(int index, System::Web::Services::Description::MessagePart ^ value); };
public System.Web.Services.Description.MessagePart this[int index] { get; set; }
member this.Item(int) : System.Web.Services.Description.MessagePart with get, set
Default Public Property Item(index As Integer) As MessagePart

パラメーター

index
Int32

変更または返される値を持つ MessagePart に対応する、0 から始まるインデックス番号。

プロパティ値

MessagePart

次の例では、0 から始まるインデックスを使用して のメンバーを反復処理する方法を MessagePartCollection示します。

// Get the message part collection for each message.
for ( int i = 0; i < myMessageCollection->Count; ++i )
{
   Console::WriteLine( "Message      : {0}", myMessageCollection[ i ]->Name );

   // Get the message part collection.
   MessagePartCollection^ myMessagePartCollection = myMessageCollection[ i ]->Parts;

   // Display the part collection.
   for ( int k = 0; k < myMessagePartCollection->Count; k++ )
   {
      Console::WriteLine( "\t       Part Name     : {0}", myMessagePartCollection[ k ]->Name );
      Console::WriteLine( "\t       Message Name  : {0}", myMessagePartCollection[ k ]->Message->Name );
   }
   Console::WriteLine( "" );
}
// Get the message part collection for each message.
for(int i =0; i < myMessageCollection.Count; ++i)
{
   Console.WriteLine("Message      : " + myMessageCollection[i].Name);

   // Get the message part collection.
   MessagePartCollection myMessagePartCollection =
      myMessageCollection[i].Parts;

   // Display the part collection.
   for(int k = 0; k < myMessagePartCollection.Count;k++)
   {
      Console.WriteLine("\t       Part Name     : " +
         myMessagePartCollection[k].Name);
      Console.WriteLine("\t       Message Name  : " +
         myMessagePartCollection[k].Message.Name);
   }
   Console.WriteLine("");
}
' Get the message part collection for each message.
Dim i As Integer
For i =0 to myMessageCollection.Count-1
   Console.WriteLine("Message      : " & myMessageCollection(i).Name)

   ' Get the message part collection.
   Dim myMessagePartCollection As MessagePartCollection = _
      myMessageCollection(i).Parts

   ' Display the part collection.
   Dim k As Integer
   For k = 0 To myMessagePartCollection.Count - 1
      Console.WriteLine(ControlChars.Tab & "       Part Name     : " & _
         myMessagePartCollection(k).Name)
      Console.WriteLine(ControlChars.Tab & "       Message Name  : " & _
         myMessagePartCollection(k).Message.Name)
   Next k
   Console.WriteLine("")
Next

適用対象

Item[String]

ソース:
ServiceDescription.cs
ソース:
ServiceDescription.cs
ソース:
ServiceDescription.cs

名前で指定された MessagePart を取得します。

public:
 property System::Web::Services::Description::MessagePart ^ default[System::String ^] { System::Web::Services::Description::MessagePart ^ get(System::String ^ name); };
public System.Web.Services.Description.MessagePart this[string name] { get; }
member this.Item(string) : System.Web.Services.Description.MessagePart
Default Public ReadOnly Property Item(name As String) As MessagePart

パラメーター

name
String

返された MessagePart の名前。

プロパティ値

MessagePart

Message^ myLocalMessage = myServiceDescription->Messages[ "AddHttpPostOut" ];
if ( myMessageCollection->Contains( myLocalMessage ) )
{
   Console::WriteLine( "Message      : {0}", myLocalMessage->Name );

   // Get the message part collection.
   MessagePartCollection^ myMessagePartCollection = myLocalMessage->Parts;
   array<MessagePart^>^myMessagePart = gcnew array<MessagePart^>(myMessagePartCollection->Count);
   
   // Copy the MessagePartCollection to an array.
   myMessagePartCollection->CopyTo( myMessagePart, 0 );
   for ( int k = 0; k < myMessagePart->Length; k++ )
      Console::WriteLine( "\t       Part Name : {0}", myMessagePartCollection[ k ]->Name );
   Console::WriteLine( "" );
}
Message myLocalMessage = myServiceDescription.Messages["AddHttpPostOut"];
if (myMessageCollection.Contains(myLocalMessage))
{
   Console.WriteLine("Message      : " + myLocalMessage.Name);

   // Get the message part collection.
   MessagePartCollection myMessagePartCollection = myLocalMessage.Parts;
   MessagePart[] myMessagePart  =
      new MessagePart[myMessagePartCollection.Count];

   // Copy the MessagePartCollection to an array.
   myMessagePartCollection.CopyTo(myMessagePart,0);
   for(int k = 0; k < myMessagePart.Length; k++)
   {
      Console.WriteLine("\t       Part Name : " +
         myMessagePartCollection[k].Name);
   }
   Console.WriteLine("");
}
Dim myLocalMessage As Message = _
   myServiceDescription.Messages("AddHttpPostOut")
If myMessageCollection.Contains(myLocalMessage) Then
   Console.WriteLine("Message      : " & myLocalMessage.Name)

   ' Get the message part collection.
   Dim myMessagePartCollection As MessagePartCollection = _
      myLocalMessage.Parts
   Dim myMessagePart(myMessagePartCollection.Count) As MessagePart

   ' Copy the MessagePartCollection to an array.
   myMessagePartCollection.CopyTo(myMessagePart, 0)
   Dim k As Integer
   For k = 0 To myMessagePart.Length - 2
      Console.WriteLine(ControlChars.Tab & "       Part Name : " & _
         myMessagePartCollection(k).Name)
   Next k
   Console.WriteLine("")
End If

適用対象