PortTypeCollection クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
PortType クラスのインスタンスのコレクションを表します。これは、XML Web サービスでサポートされる操作のセットのコレクションです。 このクラスは継承できません。
public ref class PortTypeCollection sealed : System::Web::Services::Description::ServiceDescriptionBaseCollection
public sealed class PortTypeCollection : System.Web.Services.Description.ServiceDescriptionBaseCollection
type PortTypeCollection = class
inherit ServiceDescriptionBaseCollection
Public NotInheritable Class PortTypeCollection
Inherits ServiceDescriptionBaseCollection
- 継承
例
#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 );
}
}
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);
}
}
}
Imports System.Web.Services.Description
Imports System.Xml
Imports System.Collections
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
End Class
プロパティ
Capacity |
CollectionBase に格納できる要素の数を取得または設定します。 (継承元 CollectionBase) |
Count |
CollectionBase インスタンスに含まれる要素の数を取得します。 このプロパティはオーバーライドできません。 (継承元 CollectionBase) |
InnerList |
ArrayList インスタンス内の要素のリストを格納する CollectionBase を取得します。 (継承元 CollectionBase) |
Item[Int32] |
指定の 0 から始まるインデックス番号に対応する PortType の値を取得または設定します。 |
Item[String] |
名前で指定した PortType を取得します。 |
List |
IList インスタンス内の要素のリストを格納する CollectionBase を取得します。 (継承元 CollectionBase) |
Table |
ServiceDescriptionBaseCollection 内のキーと値の関連付けを実装するインターフェイスを取得します。 (継承元 ServiceDescriptionBaseCollection) |
メソッド
明示的なインターフェイスの実装
拡張メソッド
Cast<TResult>(IEnumerable) |
IEnumerable の要素を、指定した型にキャストします。 |
OfType<TResult>(IEnumerable) |
指定された型に基づいて IEnumerable の要素をフィルター処理します。 |
AsParallel(IEnumerable) |
クエリの並列化を有効にします。 |
AsQueryable(IEnumerable) |
IEnumerable を IQueryable に変換します。 |
適用対象
.NET