指定の 0 から始まるインデックス番号に対応する PortType の値を取得または設定します。
[C#] C# では、このプロパティは PortTypeCollection クラスのインデクサになります。
Overloads Public Default Property Item( _
ByVal index As Integer _) As PortType
[C#]
public PortType this[intindex] {get; set;}
[C++]
public: __property PortType* get_Item(intindex);public: __property void set_Item(intindex, PortType*);
[JScript]
returnValue = PortTypeCollectionObject.Item(index);PortTypeCollectionObject.Item(index) = returnValue;またはreturnValue = PortTypeCollectionObject(index);PortTypeCollectionObject(index) = returnValue;
[JScript] JScript では、この型で定義されている既定のインデックス プロパティを使用することができます。しかし、独自のインデックス プロパティを明示的に定義することはできません。ただし、このクラスの expando 属性を指定すると、既定のインデックス プロパティが提供されます。提供されるインデックス プロパティの型は Object 型であり、インデックス型は String になります。
引数 [JScript]
- index
変更または返される値を持つ PortType に対応する、0 から始まるインデックス番号。
パラメータ [Visual Basic, C#, C++]
- index
変更または返される値を持つ PortType に対応する、0 から始まるインデックス番号。
プロパティ値
PortType 。
使用例
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(0)
Console.WriteLine( _
"The PortType at index 0 is: " & myNewPortType.Name)
Console.WriteLine("Removing the PortType " & myNewPortType.Name)
' Remove the PortType from the collection.
myPortTypeCollection.Remove(myNewPortType)
' Display the number of PortTypes.
Console.WriteLine(ControlChars.Newline & _
"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())
myServiceDescription.Write("MathService_New.wsdl")
[C#]
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[0];
Console.WriteLine(
"The PortType at index 0 is: " + myNewPortType.Name);
Console.WriteLine("Removing the PortType " + myNewPortType.Name);
// Remove the PortType from the collection.
myPortTypeCollection.Remove(myNewPortType);
// Display the number of PortTypes.
Console.WriteLine("\nTotal 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);
myServiceDescription.Write("MathService_New.wsdl");
[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(myServiceDescription->PortTypes->Count));
// Get the first PortType in the collection.
PortType* myNewPortType = myPortTypeCollection->Item[0];
Console::WriteLine(
S"The PortType at index 0 is: {0}", myNewPortType->Name);
Console::WriteLine(S"Removing the PortType {0}", myNewPortType->Name);
// Remove the PortType from the collection.
myPortTypeCollection->Remove(myNewPortType);
// Display the number of PortTypes.
Console::WriteLine(S"\nTotal number of PortTypes after removing: {0}", __box(myServiceDescription->PortTypes->Count));
Console::WriteLine(S"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(S"Total number of PortTypes after adding a new port: {0}", __box(myServiceDescription->PortTypes->Count));
myServiceDescription->Write(S"MathService_New.wsdl");
[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 名前空間 | PortTypeCollection.Item オーバーロードの一覧