PortTypeCollection 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
PortType 클래스의 인스턴스의 컬렉션, 즉 XML Web services에서 지원되는 작업 집합의 컬렉션을 나타냅니다. 이 클래스는 상속될 수 없습니다.
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로 변환합니다. |