PortTypeCollection Classe
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Representa uma coleção de instâncias da PortType classe; ou seja, uma coleção de conjuntos de operações suportadas pelo serviço Web XML. Esta 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
| Name | 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. Esta propriedade não pode ser substituída. (Herdado de CollectionBase) |
| InnerList |
Obtém um ArrayList contendo a lista de elementos na CollectionBase instância. (Herdado de CollectionBase) |
| Item[Int32] |
Obtém ou define o valor de a PortType no índice zero especificado. |
| Item[String] |
Obtém o PortType especificado pelo nome. |
| List |
Obtém um IList contendo a lista de 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
| Name | 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 ultrapassado. (Herdado de CollectionBase) |
| Contains(PortType) |
Devolve um valor que indica se o especificado PortType é membro do PortTypeCollection. |
| CopyTo(PortType[], Int32) |
Copia todo PortTypeCollection para um array unidimensional do tipo PortType, começando no índice zero especificado do array alvo. |
| Equals(Object) |
Determina se o objeto especificado é igual ao objeto atual. (Herdado de Object) |
| GetEnumerator() |
Devolve um enumerador que itera pela CollectionBase instância. (Herdado de CollectionBase) |
| GetHashCode() |
Serve como função de hash predefinida. (Herdado de Object) |
| GetKey(Object) |
Devolve 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) |
Procura o especificado PortType e devolve o índice baseado em zero da primeira ocorrência dentro da coleção. |
| Insert(Int32, PortType) |
Soma o especificado PortType ao PortTypeCollection no índice baseado em zero especificado. |
| MemberwiseClone() |
Cria uma cópia superficial do atual Object. (Herdado de Object) |
| OnClear() |
Limpa o conteúdo da ServiceDescriptionBaseCollection instância. (Herdado de ServiceDescriptionBaseCollection) |
| OnClearComplete() |
Realiza processos personalizados adicionais após limpar o conteúdo da CollectionBase instância. (Herdado de CollectionBase) |
| OnInsert(Int32, Object) |
Realiza processos personalizados adicionais antes de inserir um novo elemento na CollectionBase instância. (Herdado de CollectionBase) |
| OnInsertComplete(Int32, Object) |
Executa processos personalizados adicionais após 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 após 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 após definir um valor na CollectionBase instância. (Herdado de CollectionBase) |
| OnValidate(Object) |
Realiza 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. Este método não é ultrapassível. (Herdado de CollectionBase) |
| SetParent(Object, Object) |
Define o objeto pai da ServiceDescriptionBaseCollection instância. (Herdado de ServiceDescriptionBaseCollection) |
| ToString() |
Devolve uma cadeia que representa o objeto atual. (Herdado de Object) |
Implementações de Interface Explícita
| Name | Description |
|---|---|
| ICollection.CopyTo(Array, Int32) |
Copia a totalidade CollectionBase para uma unidimensional Arraycompatível , começando no índice especificado do array alvo. (Herdado de CollectionBase) |
| ICollection.IsSynchronized |
Recebe um valor que indica se o acesso ao CollectionBase é 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 contém um elemento específico. (Herdado de CollectionBase) |
| IList.IndexOf(Object) |
Procura o especificado Object e devolve o índice baseado em zero da primeira ocorrência dentro de todo CollectionBaseo . (Herdado de CollectionBase) |
| IList.Insert(Int32, Object) |
Insere um elemento no CollectionBase índice especificado. (Herdado de CollectionBase) |
| IList.IsFixedSize |
Obtém um valor que indica se o CollectionBase tem um tamanho fixo. (Herdado de CollectionBase) |
| IList.IsReadOnly |
Recebe um valor que indica se o CollectionBase é apenas de 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 da Extensão
| Name | Description |
|---|---|
| AsParallel(IEnumerable) |
Permite a paralelização de uma consulta. |
| AsQueryable(IEnumerable) |
Converte um IEnumerable para um IQueryable. |
| Cast<TResult>(IEnumerable) |
Conjura os elementos de an IEnumerable para o tipo especificado. |
| OfType<TResult>(IEnumerable) |
Filtra os elementos de um IEnumerable com base num tipo especificado. |