Name プロパティによって指定された Port を取得します。
[C#] C# では、このプロパティは PortCollection クラスのインデクサになります。
Overloads Public Default ReadOnly Property Item( _
ByVal name As String _) As Port
[C#]
public Port this[stringname] {get;}
[C++]
public: __property Port* get_Item(String* name);
[JScript]
returnValue = PortCollectionObject.Item(name);またはreturnValue = PortCollectionObject(name);
[JScript] JScript では、この型で定義されている既定のインデックス プロパティを使用することができます。しかし、独自のインデックス プロパティを明示的に定義することはできません。ただし、このクラスの expando 属性を指定すると、既定のインデックス プロパティが提供されます。提供されるインデックス プロパティの型は Object 型であり、インデックス型は String になります。
引数 [JScript]
- name
返された Port の名前。
パラメータ [Visual Basic, C#, C++]
- name
返された Port の名前。
プロパティ値
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
Dim strPort As String = myPortCollection(0).Name
Dim myPort As Port = myPortCollection(strPort)
Console.WriteLine(ControlChars.NewLine & _
"Index of Port[" & strPort & "] : " & _
myPortCollection.IndexOf(myPort).ToString)
[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);
}
string strPort = myPortCollection[0].Name;
Port myPort = myPortCollection[strPort];
Console.WriteLine("\nIndex of Port[" + strPort + "] : " +
myPortCollection.IndexOf(myPort));
[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);
}
String* strPort = myPortCollection->Item[0]->Name;
Port* myPort = myPortCollection->Item[strPort];
Console::WriteLine(S"\nIndex of Port[{0}] : {1}", strPort, __box(myPortCollection->IndexOf(myPort)));
[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 オーバーロードの一覧