指定の 0 から始まるインデックス番号に対応する Port の値を取得または設定します。
[C#] C# では、このプロパティは PortCollection クラスのインデクサになります。
Overloads Public Default Property Item( _
ByVal index As Integer _) As Port
[C#]
public Port this[intindex] {get; set;}
[C++]
public: __property Port* get_Item(intindex);public: __property void set_Item(intindex, Port*);
[JScript]
returnValue = PortCollectionObject.Item(index);PortCollectionObject.Item(index) = returnValue;またはreturnValue = PortCollectionObject(index);PortCollectionObject(index) = returnValue;
[JScript] JScript では、この型で定義されている既定のインデックス プロパティを使用することができます。しかし、独自のインデックス プロパティを明示的に定義することはできません。ただし、このクラスの expando 属性を指定すると、既定のインデックス プロパティが提供されます。提供されるインデックス プロパティの型は Object 型であり、インデックス型は String になります。
引数 [JScript]
- index
変更または返される値を持つ Port に対応する、0 から始まるインデックス番号。
パラメータ [Visual Basic, C#, C++]
- index
変更または返される値を持つ Port に対応する、0 から始まるインデックス番号。
プロパティ値
Port 。
使用例
Dim myService As Service
Dim myPortCollection As PortCollection
Dim myServiceDescription As ServiceDescription = _
ServiceDescription.Read("MathServiceItem_vb.wsdl")
Console.WriteLine("Total number of services : " & _
myServiceDescription.Services.Count.ToString)
Dim i As Integer
For i = 0 to myServiceDescription.Services.Count - 1
myService = myServiceDescription.Services(i)
Console.WriteLine("Name : " & myService.Name)
myPortCollection = myService.Ports
' Create an array of ports.
Console.WriteLine(ControlChars.NewLine & "Port collection :")
Dim i1 As Integer
For i1 = 0 to myService.Ports.Count - 1
Console.WriteLine("Port[" & i1.ToString & "] : " & _
myPortCollection(i1).Name)
Next
[C#]
Service myService;
PortCollection myPortCollection;
ServiceDescription myServiceDescription =
ServiceDescription.Read("MathServiceItem_cs.wsdl");
Console.WriteLine("Total number of services : "
+ myServiceDescription.Services.Count);
for(int i=0; i < myServiceDescription.Services.Count; ++i)
{
myService = myServiceDescription.Services[i];
Console.WriteLine("Name : " + myService.Name);
myPortCollection = myService.Ports;
// Create an array of ports.
Console.WriteLine("\nPort collection :");
for(int i1=0 ; i1 < myService.Ports.Count ; ++i1)
{
Console.WriteLine("Port[" + i1+"] : " +
myPortCollection[i1].Name);
}
[C++]
Service* myService;
PortCollection* myPortCollection;
ServiceDescription* myServiceDescription =
ServiceDescription::Read(S"MathServiceItem_cs.wsdl");
Console::WriteLine(S"Total number of services : {0}", __box(myServiceDescription->Services->Count));
for(int i=0; i < myServiceDescription->Services->Count; ++i)
{
myService = myServiceDescription->Services->Item[i];
Console::WriteLine(S"Name : {0}", myService->Name);
myPortCollection = myService->Ports;
// Create an array of ports.
Console::WriteLine(S"\nPort collection :");
for(int i1=0 ; i1 < myService->Ports->Count ; ++i1)
{
Console::WriteLine(S"Port[{0}] : {1}", __box(i1), myPortCollection->Item[i1]->Name);
}
[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 ファミリ
参照
PortCollection クラス | PortCollection メンバ | System.Web.Services.Description 名前空間 | PortCollection.Item オーバーロードの一覧