次の方法で共有


PortTypeCollection.IndexOf メソッド

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

Public Function IndexOf( _
   ByVal portType As PortType _) As Integer
[C#]
public int IndexOf(PortTypeportType);
[C++]
public: int IndexOf(PortType* portType);
[JScript]
public function IndexOf(
   portType : PortType) : int;

パラメータ

  • portType
    コレクション内での検索対象となる PortType

戻り値

32 ビット符号付き整数。

使用例

 
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: " & noOfPortTypes.ToString())

Dim myNewPortType As PortType = myPortTypeCollection("MathServiceSoap")
' Get the index in the collection.
Dim index As Integer = myPortTypeCollection.IndexOf(myNewPortType)

[C#] 
ServiceDescription myServiceDescription = 
   ServiceDescription.Read("MathService_CS.wsdl");

PortTypeCollection myPortTypeCollection = 
   myServiceDescription.PortTypes;
int noOfPortTypes = myServiceDescription.PortTypes.Count;
Console.WriteLine("\nTotal number of PortTypes: " + noOfPortTypes);

PortType myNewPortType = myPortTypeCollection["MathServiceSoap"];

// Get the index in the collection.
int index = myPortTypeCollection.IndexOf(myNewPortType);

[C++] 
ServiceDescription* myServiceDescription = 
   ServiceDescription::Read(S"MathService_CS.wsdl");

PortTypeCollection* myPortTypeCollection = 
   myServiceDescription->PortTypes;
int noOfPortTypes = myServiceDescription->PortTypes->Count;
Console::WriteLine(S"\nTotal number of PortTypes: {0}", __box(noOfPortTypes));

PortType* myNewPortType = myPortTypeCollection->Item[S"MathServiceSoap"];

// Get the index in the collection.
int index = myPortTypeCollection->IndexOf(myNewPortType);

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

PortTypeCollection クラス | PortTypeCollection メンバ | System.Web.Services.Description 名前空間