MessagePartCollection.IndexOf メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > MessagePartCollection.IndexOf メソッドの意味・解説 

MessagePartCollection.IndexOf メソッド

指定した MessagePart検索しコレクション内で最初に見つかった位置の 0 から始まるインデックス番号返します

名前空間: System.Web.Services.Description
アセンブリ: System.Web.Services (system.web.services.dll 内)
構文構文

Public Function IndexOf ( _
    messagePart As MessagePart _
) As Integer
Dim instance As MessagePartCollection
Dim messagePart As MessagePart
Dim returnValue As Integer

returnValue = instance.IndexOf(messagePart)
public int IndexOf (
    MessagePart messagePart
)
public:
int IndexOf (
    MessagePart^ messagePart
)
public int IndexOf (
    MessagePart messagePart
)
public function IndexOf (
    messagePart : MessagePart
) : int

パラメータ

messagePart

コレクション内での検索対象となる MessagePart。

戻り値
32 ビット符号付き整数

使用例使用例

IndexOf メソッド使用して指定した MessagePartコレクションメンバであるかどうか確認する例を次に示します

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
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..."
 );
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.get_Messages().
    get_Item("AddHttpPostOut");
if (myMessageCollection.Contains(myMessage)) {
    // Get the message part collection.
    MessagePartCollection myMessagePartCollection = 
        myMessage.get_Parts();

    // Get the part named Body.
    MessagePart myMessagePart = myMessage.get_Parts().get_Item("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.");
        }
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
MessagePartCollection クラス
MessagePartCollection メンバ
System.Web.Services.Description 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からMessagePartCollection.IndexOf メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からMessagePartCollection.IndexOf メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からMessagePartCollection.IndexOf メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

MessagePartCollection.IndexOf メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



MessagePartCollection.IndexOf メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS