PortTypeCollectionとは? わかりやすく解説

PortTypeCollection クラス

PortType クラスのインスタンスのコレクションを表します。これは XML Web サービスでサポートされる操作のセットのコレクションです。このクラスは継承できません。

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

Public NotInheritable Class
 PortTypeCollection
    Inherits ServiceDescriptionBaseCollection
Dim instance As PortTypeCollection
public sealed class PortTypeCollection : ServiceDescriptionBaseCollection
public ref class PortTypeCollection sealed
 : public ServiceDescriptionBaseCollection
public final class PortTypeCollection extends
 ServiceDescriptionBaseCollection
public final class PortTypeCollection extends
 ServiceDescriptionBaseCollection
使用例使用例
Imports System
Imports System.Web.Services.Description
Imports System.Xml
Imports System.Collections
Imports Microsoft.VisualBasic

Class MyPortTypeCollectionClass
   Public Shared Sub Main()
      Try
         ' Read the existing Web service description file.
         Dim myServiceDescription As ServiceDescription
 = _
            ServiceDescription.Read("MathService_vb.wsdl")
         Dim myPortTypeCollection As PortTypeCollection
 = _
            myServiceDescription.PortTypes
         Dim noOfPortTypes As Integer
 = _
            myServiceDescription.PortTypes.Count
         Console.WriteLine( _
            ControlChars.Newline & "Total number of PortTypes:
 " & _
            myServiceDescription.PortTypes.Count.ToString())

         ' Get the first PortType in the collection.
         Dim myNewPortType As PortType = _
            myPortTypeCollection("MathServiceSoap")
         Dim index As Integer
 = myPortTypeCollection.IndexOf(myNewPortType)
         Console.WriteLine("The PortType with the name "
 & _
            myNewPortType.Name & " is at index: "
 & (index + 1).ToString())

         Console.WriteLine("Removing the PortType: "
 & myNewPortType.Name)

         ' Remove the PortType from the collection.
         myPortTypeCollection.Remove(myNewPortType)
         Dim bContains As Boolean
 = _
            myPortTypeCollection.Contains(myNewPortType)
         Console.WriteLine("The PortType with the Name "
 & _
            myNewPortType.Name & " exists: " &
 bContains.ToString())

         Console.WriteLine("Total Number of PortTypes after removing:
 " & _
            myServiceDescription.PortTypes.Count.ToString())

         Console.WriteLine("Adding a PortType: " &
 myNewPortType.Name)

         ' Add a new portType from the collection.
         myPortTypeCollection.Add(myNewPortType)

         ' Display the number of portTypes after adding a port.
         Console.WriteLine( _
            "Total Number of PortTypes after adding a new port:
 " & _
            myServiceDescription.PortTypes.Count.ToString())

         ' List the PortTypes available in the WSDL document.
         Dim myPortType As PortType
         For Each myPortType In
  myPortTypeCollection
            Console.WriteLine("The PortType name is: "
 & myPortType.Name)
         Next myPortType
         myServiceDescription.Write("MathService_New.wsdl")
      Catch e As Exception
         Console.WriteLine("Exception: " & e.Message)
      End Try
   End Sub 'Main
End Class 'MyPortTypeCollectionClass
using System;
using System.Web.Services.Description;
using System.Xml;
using System.Collections;

class MyPortTypeCollectionClass
{
   public static void Main()
   {
      try
      {
         // Read the existing Web service description file.
         ServiceDescription myServiceDescription = 
            ServiceDescription.Read("MathService_CS.wsdl");
         PortTypeCollection myPortTypeCollection = 
            myServiceDescription.PortTypes;
         int noOfPortTypes = myServiceDescription.PortTypes.Count;
         Console.WriteLine("\nTotal number of PortTypes: " 
            + myServiceDescription.PortTypes.Count);
         
         // Get the first PortType in the collection.
         PortType myNewPortType = myPortTypeCollection["MathServiceSoap"];
         int index = myPortTypeCollection.IndexOf(myNewPortType);
         Console.WriteLine("The PortType with the name " + myNewPortType.Name
 
            + " is at index: " + (index+1));

         Console.WriteLine("Removing the PortType: " + myNewPortType.Name);

         // Remove the PortType from the collection.
         myPortTypeCollection.Remove(myNewPortType);
         bool bContains = myPortTypeCollection.Contains(myNewPortType);
         Console.WriteLine("The PortType with the name " + myNewPortType.Name
 
            + " exists: " + bContains);

         Console.WriteLine("Total number of PortTypes after removing: "
            + myServiceDescription.PortTypes.Count);

         Console.WriteLine("Adding a PortType: " + myNewPortType.Name);

         // Add a new portType from the collection.
         myPortTypeCollection.Add(myNewPortType);

         // Display the number of portTypes after adding a port.
         Console.WriteLine("Total number of PortTypes after "
            + "adding a new port: " + myServiceDescription.PortTypes.Count);

         // List the PortTypes available in the WSDL document.
         foreach(PortType myPortType in myPortTypeCollection)
           Console.WriteLine("The PortType name is: " + myPortType.Name);
           
         myServiceDescription.Write("MathService_New.wsdl");
      }
      catch(Exception e)
      {
         Console.WriteLine("Exception: " + e.Message);
      }
   }
}
#using <System.Xml.dll>
#using <System.Web.Services.dll>
#using <System.dll>

using namespace System;
using namespace System::Web::Services::Description;
using namespace System::Xml;
using namespace System::Collections;
int main()
{
   try
   {
      // Read the existing Web service description file.
      ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_CS.wsdl"
 );
      PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes;
      int noOfPortTypes = myServiceDescription->PortTypes->Count;
      Console::WriteLine( "\nTotal number of PortTypes: {0}", myServiceDescription->PortTypes->Count
 );

      // Get the first PortType in the collection.
      PortType^ myNewPortType = myPortTypeCollection[ "MathServiceSoap"
 ];
      int index = myPortTypeCollection->IndexOf( myNewPortType
 );
      Console::WriteLine( "The PortType with the name {0} is at index: {1}",
 myNewPortType->Name, (index + 1) );
      Console::WriteLine( "Removing the PortType: {0}", myNewPortType->Name
 );

      // Remove the PortType from the collection.
      myPortTypeCollection->Remove( myNewPortType );
      bool bContains = myPortTypeCollection->Contains( myNewPortType
 );
      Console::WriteLine( "The PortType with the name {0} exists: {1}",
 myNewPortType->Name, bContains );
      Console::WriteLine( "Total number of PortTypes after removing: {0}",
 myServiceDescription->PortTypes->Count );
      Console::WriteLine( "Adding a PortType: {0}", myNewPortType->Name
 );

      // Add a new portType from the collection.
      myPortTypeCollection->Add( myNewPortType );

      // Display the number of portTypes after adding a port.
      Console::WriteLine( "Total number of PortTypes after adding a new
 port: {0}", myServiceDescription->PortTypes->Count );

      // List the PortTypes available in the WSDL document.
      IEnumerator^ myEnum = myPortTypeCollection->GetEnumerator();
      while ( myEnum->MoveNext() )
      {
         PortType^ myPortType = safe_cast<PortType^>(myEnum->Current);
         Console::WriteLine( "The PortType name is: {0}", myPortType->Name
 );
      }
      myServiceDescription->Write( "MathService_New.wsdl" );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "Exception: {0}", e->Message );
   }
}
import System.*;
import System.Web.Services.Description.*;
import System.Xml.*;
import System.Collections.*;

class MyPortTypeCollectionClass
{
    public static void main(String[]
 args)
    {
        try {
            // Read the existing Web service description file.
            ServiceDescription myServiceDescription = ServiceDescription.Read(
                "MathService_JSL.wsdl");
            PortTypeCollection myPortTypeCollection = myServiceDescription.
                get_PortTypes();
            int noOfPortTypes = myServiceDescription.get_PortTypes().
                get_Count();
            Console.WriteLine("\nTotal number of PortTypes: " 
                + myServiceDescription.get_PortTypes().get_Count());

            // Get the first PortType in the collection.
            PortType myNewPortType = myPortTypeCollection.get_Item(
                "MathServiceSoap");
            int index = myPortTypeCollection.IndexOf(myNewPortType);
            Console.WriteLine("The PortType with the name " 
                + myNewPortType.get_Name() + " is at index: " + (index
 + 1));

            Console.WriteLine("Removing the PortType: " 
                + myNewPortType.get_Name());

            // Remove the PortType from the collection.
            myPortTypeCollection.Remove(myNewPortType);
            boolean bContains = myPortTypeCollection.Contains(myNewPortType);
            Console.WriteLine("The PortType with the name " 
                + myNewPortType.get_Name() + " exists: " 
                + System.Convert.ToString(bContains));

            Console.WriteLine("Total number of PortTypes after removing: "
 
                + myServiceDescription.get_PortTypes().get_Count());

            Console.WriteLine("Adding a PortType: " 
                + myNewPortType.get_Name());

            // Add a new portType from the collection.
            myPortTypeCollection.Add(myNewPortType);

            // Display the number of portTypes after adding a port.
            Console.WriteLine("Total number of PortTypes after " 
                + "adding a new port: " + myServiceDescription.get_PortTypes().
                get_Count());

            // List the PortTypes available in the WSDL document.
            for (int iCtr = 0; iCtr < myPortTypeCollection.get_Count();
 iCtr++) {
                PortType myPortType = myPortTypeCollection.get_Item(iCtr);
                Console.WriteLine("The PortType name is: " 
                    + myPortType.get_Name());
            }
            myServiceDescription.Write("MathService_New.wsdl");
        }
        catch (System.Exception e) {
            Console.WriteLine("Exception: " + e.get_Message());
        }
    } //main
} //MyPortTypeCollectionClass
継承階層継承階層
System.Object
   System.Collections.CollectionBase
     System.Web.Services.Description.ServiceDescriptionBaseCollection
      System.Web.Services.Description.PortTypeCollection
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
PortTypeCollection メンバ
System.Web.Services.Description 名前空間

PortTypeCollection プロパティ


パブリック プロパティパブリック プロパティ

( プロテクト プロパティ も参照)
  名前 説明
パブリック プロパティ Capacity  CollectionBase に格納できる要素の数を取得または設定します。 ( CollectionBase から継承されます。)
パブリック プロパティ Count  CollectionBase インスタンスに格納されている要素の数を取得します。このプロパティはオーバーライドできません。 ( CollectionBase から継承されます。)
パブリック プロパティ Item オーバーロードされます。 渡されたパラメータによって指定された PortType を取得または設定します。
プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ InnerList  CollectionBase インスタンス内の要素のリストを格納する ArrayList を取得します。 ( CollectionBase から継承されます。)
プロテクト プロパティ List  CollectionBase インスタンス内の要素のリストを格納する IList を取得します。 ( CollectionBase から継承されます。)
参照参照

関連項目

PortTypeCollection クラス
System.Web.Services.Description 名前空間

PortTypeCollection メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド Add 指定した PortType を PortTypeCollection の末尾に追加します。
パブリック メソッド Clear  CollectionBase インスタンスからすべてのオブジェクトを削除します。このメソッドはオーバーライドできません。 ( CollectionBase から継承されます。)
パブリック メソッド Contains 指定した PortType が PortTypeCollection のメンバかどうかを示す値を返します。
パブリック メソッド CopyTo PortType 型の 1 次元配列に、その配列内の指定した 0 から始まるインデックスを開始位置として PortTypeCollection 全体をコピーします。
パブリック メソッド Equals  オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。)
パブリック メソッド GetEnumerator  CollectionBase インスタンスを反復処理する列挙子を返します。 ( CollectionBase から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 ( Object から継承されます。)
パブリック メソッド IndexOf 指定した PortType を検索し、コレクション内で最初に見つかった位置の 0 から始まるインデックス番号を返します。
パブリック メソッド Insert 指定した 0 から始まるインデックス番号にある PortTypeCollection に、指定した PortType を追加します。
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。)
パブリック メソッド Remove PortTypeCollection 内で最初に見つかった指定の PortType を削除します。
パブリック メソッド RemoveAt  CollectionBase インスタンスの指定したインデックスにある要素を削除します。このメソッドはオーバーライドできません。 ( CollectionBase から継承されます。)
パブリック メソッド ToString  現在の Object を表す String を返します。 ( Object から継承されます。)
プロテクト メソッドプロテクト メソッド
  名前 説明
プロテクト メソッド Finalize  Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。)
プロテクト メソッド MemberwiseClone  現在の Object の簡易コピーを作成します。 ( Object から継承されます。)
プロテクト メソッド OnClear  CollectionBase インスタンスの内容を消去するときに、追加のカスタム プロセスを実行します。 ( CollectionBase から継承されます。)
プロテクト メソッド OnClearComplete  CollectionBase インスタンスの内容を消去した後に、追加のカスタム プロセスを実行します。 ( CollectionBase から継承されます。)
プロテクト メソッド OnInsert  CollectionBase インスタンスに新しい要素を挿入する前に、追加のカスタム プロセスを実行します。 ( CollectionBase から継承されます。)
プロテクト メソッド OnInsertComplete  CollectionBase インスタンスに新しい要素を挿入した後に、追加のカスタム プロセスを実行します。 ( CollectionBase から継承されます。)
プロテクト メソッド OnRemove  CollectionBase インスタンスから要素を削除するときに、追加のカスタム プロセスを実行します。 ( CollectionBase から継承されます。)
プロテクト メソッド OnRemoveComplete  CollectionBase インスタンスから要素を削除した後に、追加のカスタム プロセスを実行します。 ( CollectionBase から継承されます。)
プロテクト メソッド OnSet  CollectionBase インスタンスに値を設定する前に、追加のカスタム プロセスを実行します。 ( CollectionBase から継承されます。)
プロテクト メソッド OnSetComplete  CollectionBase インスタンスに値を設定した後に、追加のカスタム プロセスを実行します。 ( CollectionBase から継承されます。)
プロテクト メソッド OnValidate  値を検証するときに、追加のカスタム プロセスを実行します。 ( CollectionBase から継承されます。)
参照参照

関連項目

PortTypeCollection クラス
System.Web.Services.Description 名前空間

PortTypeCollection メンバ

PortType クラスのインスタンスのコレクションを表します。これは XML Web サービスでサポートされる操作のセットのコレクションです。このクラスは継承できません。

PortTypeCollection データ型で公開されるメンバを以下の表に示します。


パブリック プロパティパブリック プロパティ
( プロテクト プロパティ も参照)
  名前 説明
パブリック プロパティ Capacity  CollectionBase に格納できる要素の数を取得または設定します。(CollectionBase から継承されます。)
パブリック プロパティ Count  CollectionBase インスタンスに格納されている要素の数を取得します。このプロパティはオーバーライドできません。(CollectionBase から継承されます。)
パブリック プロパティ Item オーバーロードされます。 渡されたパラメータによって指定された PortType を取得または設定します。
プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ InnerList  CollectionBase インスタンス内の要素のリストを格納する ArrayList を取得します。(CollectionBase から継承されます。)
プロテクト プロパティ List  CollectionBase インスタンス内の要素のリストを格納する IList を取得します。(CollectionBase から継承されます。)
パブリック メソッドパブリック メソッド
( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド Add 指定した PortType を PortTypeCollection の末尾に追加します。
パブリック メソッド Clear  CollectionBase インスタンスからすべてのオブジェクトを削除します。このメソッドはオーバーライドできません。 (CollectionBase から継承されます。)
パブリック メソッド Contains 指定した PortType が PortTypeCollection のメンバかどうかを示す値を返します。
パブリック メソッド CopyTo PortType 型の 1 次元配列に、その配列内の指定した 0 から始まるインデックスを開始位置として PortTypeCollection 全体をコピーします。
パブリック メソッド Equals  オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。)
パブリック メソッド GetEnumerator  CollectionBase インスタンスを反復処理する列挙子を返します。 (CollectionBase から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 (Object から継承されます。)
パブリック メソッド IndexOf 指定した PortType を検索し、コレクション内で最初に見つかった位置の 0 から始まるインデックス番号を返します。
パブリック メソッド Insert 指定した 0 から始まるインデックス番号にある PortTypeCollection に、指定した PortType を追加します。
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。)
パブリック メソッド Remove PortTypeCollection 内で最初に見つかった指定の PortType を削除します。
パブリック メソッド RemoveAt  CollectionBase インスタンスの指定したインデックスにある要素を削除します。このメソッドはオーバーライドできません。 (CollectionBase から継承されます。)
パブリック メソッド ToString  現在の Object を表す String を返します。 (Object から継承されます。)
プロテクト メソッドプロテクト メソッド
  名前 説明
プロテクト メソッド Finalize  Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。)
プロテクト メソッド MemberwiseClone  現在の Object の簡易コピーを作成します。 (Object から継承されます。)
プロテクト メソッド OnClear  CollectionBase インスタンスの内容を消去するときに、追加のカスタム プロセスを実行します。 (CollectionBase から継承されます。)
プロテクト メソッド OnClearComplete  CollectionBase インスタンスの内容を消去した後に、追加のカスタム プロセスを実行します。 (CollectionBase から継承されます。)
プロテクト メソッド OnInsert  CollectionBase インスタンスに新しい要素を挿入する前に、追加のカスタム プロセスを実行します。 (CollectionBase から継承されます。)
プロテクト メソッド OnInsertComplete  CollectionBase インスタンスに新しい要素を挿入した後に、追加のカスタム プロセスを実行します。 (CollectionBase から継承されます。)
プロテクト メソッド OnRemove  CollectionBase インスタンスから要素を削除するときに、追加のカスタム プロセスを実行します。 (CollectionBase から継承されます。)
プロテクト メソッド OnRemoveComplete  CollectionBase インスタンスから要素を削除した後に、追加のカスタム プロセスを実行します。 (CollectionBase から継承されます。)
プロテクト メソッド OnSet  CollectionBase インスタンスに値を設定する前に、追加のカスタム プロセスを実行します。 (CollectionBase から継承されます。)
プロテクト メソッド OnSetComplete  CollectionBase インスタンスに値を設定した後に、追加のカスタム プロセスを実行します。 (CollectionBase から継承されます。)
プロテクト メソッド OnValidate  値を検証するときに、追加のカスタム プロセスを実行します。 (CollectionBase から継承されます。)
参照参照

関連項目

PortTypeCollection クラス
System.Web.Services.Description 名前空間



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「PortTypeCollection」の関連用語

PortTypeCollectionのお隣キーワード
検索ランキング

   

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



PortTypeCollectionのページの著作権

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

©2026 GRAS Group, Inc.RSS