PortTypeCollection Classe
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Representa uma coleção de instâncias da PortType classe; ou seja, uma coleção de conjuntos de operações com suporte pelo serviço Web XML. Essa classe não pode ser herdada.
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
- Herança
Exemplos
#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
Propriedades
| Nome | Description |
|---|---|
| Capacity |
Obtém ou define o número de elementos que podem CollectionBase conter. (Herdado de CollectionBase) |
| Count |
Obtém o número de elementos contidos na CollectionBase instância. Essa propriedade não pode ser substituída. (Herdado de CollectionBase) |
| InnerList |
Obtém uma ArrayList lista que contém os elementos na CollectionBase instância. (Herdado de CollectionBase) |
| Item[Int32] |
Obtém ou define o valor de um PortType no índice baseado em zero especificado. |
| Item[String] |
Obtém o PortType especificado por seu nome. |
| List |
Obtém uma IList lista que contém os elementos na CollectionBase instância. (Herdado de CollectionBase) |
| Table |
Obtém uma interface que implementa a associação das chaves e valores no ServiceDescriptionBaseCollection. (Herdado de ServiceDescriptionBaseCollection) |
Métodos
| Nome | Description |
|---|---|
| Add(PortType) |
Adiciona o especificado PortType ao final do PortTypeCollection. |
| Clear() |
Remove todos os objetos da CollectionBase instância. Este método não pode ser substituído. (Herdado de CollectionBase) |
| Contains(PortType) |
Retorna um valor que indica se o especificado PortType é um membro do PortTypeCollection. |
| CopyTo(PortType[], Int32) |
Copia o todo PortTypeCollection para uma matriz unidimensional do tipo PortType, começando no índice de base zero especificado da matriz de destino. |
| Equals(Object) |
Determina se o objeto especificado é igual ao objeto atual. (Herdado de Object) |
| GetEnumerator() |
Retorna um enumerador que itera por meio da CollectionBase instância. (Herdado de CollectionBase) |
| GetHashCode() |
Serve como a função de hash padrão. (Herdado de Object) |
| GetKey(Object) |
Retorna o nome da chave associada ao valor passado por referência. (Herdado de ServiceDescriptionBaseCollection) |
| GetType() |
Obtém o Type da instância atual. (Herdado de Object) |
| IndexOf(PortType) |
Pesquisa o índice especificado PortType e retorna o índice baseado em zero da primeira ocorrência dentro da coleção. |
| Insert(Int32, PortType) |
Adiciona o especificado PortType ao PortTypeCollection índice baseado em zero especificado. |
| MemberwiseClone() |
Cria uma cópia superficial do Objectatual. (Herdado de Object) |
| OnClear() |
Limpa o conteúdo da ServiceDescriptionBaseCollection instância. (Herdado de ServiceDescriptionBaseCollection) |
| OnClearComplete() |
Executa processos personalizados adicionais depois de limpar o conteúdo da CollectionBase instância. (Herdado de CollectionBase) |
| OnInsert(Int32, Object) |
Executa processos personalizados adicionais antes de inserir um novo elemento na CollectionBase instância. (Herdado de CollectionBase) |
| OnInsertComplete(Int32, Object) |
Executa processos personalizados adicionais depois de inserir um novo elemento no ServiceDescriptionBaseCollection. (Herdado de ServiceDescriptionBaseCollection) |
| OnRemove(Int32, Object) |
Remove um elemento do ServiceDescriptionBaseCollection. (Herdado de ServiceDescriptionBaseCollection) |
| OnRemoveComplete(Int32, Object) |
Executa processos personalizados adicionais depois de remover um elemento da CollectionBase instância. (Herdado de CollectionBase) |
| OnSet(Int32, Object, Object) |
Substitui um valor por outro dentro do ServiceDescriptionBaseCollection. (Herdado de ServiceDescriptionBaseCollection) |
| OnSetComplete(Int32, Object, Object) |
Executa processos personalizados adicionais depois de definir um valor na CollectionBase instância. (Herdado de CollectionBase) |
| OnValidate(Object) |
Executa processos personalizados adicionais ao validar um valor. (Herdado de CollectionBase) |
| Remove(PortType) |
Remove a primeira ocorrência do especificado PortType do PortTypeCollection. |
| RemoveAt(Int32) |
Remove o elemento no índice especificado da CollectionBase instância. Esse método não é substituível. (Herdado de CollectionBase) |
| SetParent(Object, Object) |
Define o objeto pai da ServiceDescriptionBaseCollection instância. (Herdado de ServiceDescriptionBaseCollection) |
| ToString() |
Retorna uma cadeia de caracteres que representa o objeto atual. (Herdado de Object) |
Implantações explícitas de interface
| Nome | Description |
|---|---|
| ICollection.CopyTo(Array, Int32) |
Copia o todo CollectionBase para um unidimensional Arraycompatível, começando no índice especificado da matriz de destino. (Herdado de CollectionBase) |
| ICollection.IsSynchronized |
Obtém um valor que indica se o CollectionBase acesso ao é sincronizado (thread safe). (Herdado de CollectionBase) |
| ICollection.SyncRoot |
Obtém um objeto que pode ser usado para sincronizar o acesso ao CollectionBase. (Herdado de CollectionBase) |
| IList.Add(Object) |
Adiciona um objeto ao final do CollectionBase. (Herdado de CollectionBase) |
| IList.Contains(Object) |
Determina se o CollectionBase elemento contém um elemento específico. (Herdado de CollectionBase) |
| IList.IndexOf(Object) |
Pesquisa o índice especificado Object e retorna o índice baseado em zero da primeira ocorrência em todo CollectionBaseo . (Herdado de CollectionBase) |
| IList.Insert(Int32, Object) |
Insere um elemento CollectionBase no índice especificado. (Herdado de CollectionBase) |
| IList.IsFixedSize |
Obtém um valor que indica se o CollectionBase tamanho tem um tamanho fixo. (Herdado de CollectionBase) |
| IList.IsReadOnly |
Obtém um valor que indica se o CollectionBase valor é somente leitura. (Herdado de CollectionBase) |
| IList.Item[Int32] |
Obtém ou define o elemento no índice especificado. (Herdado de CollectionBase) |
| IList.Remove(Object) |
Remove a primeira ocorrência de um objeto específico do CollectionBase. (Herdado de CollectionBase) |
Métodos de Extensão
| Nome | Description |
|---|---|
| AsParallel(IEnumerable) |
Habilita a paralelização de uma consulta. |
| AsQueryable(IEnumerable) |
Converte um IEnumerable em um IQueryable. |
| Cast<TResult>(IEnumerable) |
Converte os elementos de um IEnumerable para o tipo especificado. |
| OfType<TResult>(IEnumerable) |
Filtra os elementos de um IEnumerable com base em um tipo especificado. |