PortCollection Classe
Definição
public ref class PortCollection sealed : System::Web::Services::Description::ServiceDescriptionBaseCollection
public sealed class PortCollection : System.Web.Services.Description.ServiceDescriptionBaseCollection
type PortCollection = class
inherit ServiceDescriptionBaseCollection
Public NotInheritable Class PortCollection
Inherits ServiceDescriptionBaseCollection
- Herança
Exemplos
Service^ myService;
PortCollection^ myPortCollection;
ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathServiceItem_cs.wsdl" );
Console::WriteLine( "Total number of services : {0}", myServiceDescription->Services->Count );
for ( int i = 0; i < myServiceDescription->Services->Count; ++i )
{
myService = myServiceDescription->Services[ i ];
Console::WriteLine( "Name : {0}", myService->Name );
myPortCollection = myService->Ports;
// Create an array of ports.
Console::WriteLine( "\nPort collection :" );
for ( int i1 = 0; i1 < myService->Ports->Count; ++i1 )
{
Console::WriteLine( "Port[{0}] : {1}", i1, myPortCollection[ i1 ]->Name );
}
String^ strPort = myPortCollection[ 0 ]->Name;
Port^ myPort = myPortCollection[ strPort ];
Console::WriteLine( "\nIndex of Port[{0}] : {1}", strPort, myPortCollection->IndexOf( myPort ) );
Port^ myPortTestRemove = myPortCollection[ 0 ];
Console::WriteLine( "\nTotal number of ports before removing a port '{0}' is : {1}", myPortTestRemove->Name, myService->Ports->Count );
myPortCollection->Remove( myPortTestRemove );
Console::WriteLine( "Total number of ports after removing a port '{0}' is : {1}", myPortTestRemove->Name, myService->Ports->Count );
// Create the WSDL file.
myPortCollection->Insert( 0, myPortTestRemove );
myServiceDescription->Write( "MathServiceItemNew_cs.wsdl" );
Service myService;
PortCollection myPortCollection;
ServiceDescription myServiceDescription =
ServiceDescription.Read("MathServiceItem_cs.wsdl");
Console.WriteLine("Total number of services : "
+ myServiceDescription.Services.Count);
for(int i=0; i < myServiceDescription.Services.Count; ++i)
{
myService = myServiceDescription.Services[i];
Console.WriteLine("Name : " + myService.Name);
myPortCollection = myService.Ports;
// Create an array of ports.
Console.WriteLine("\nPort collection :");
for(int i1=0 ; i1 < myService.Ports.Count ; ++i1)
{
Console.WriteLine("Port[" + i1+"] : " +
myPortCollection[i1].Name);
}
string strPort = myPortCollection[0].Name;
Port myPort = myPortCollection[strPort];
Console.WriteLine("\nIndex of Port[" + strPort + "] : " +
myPortCollection.IndexOf(myPort));
Port myPortTestRemove = myPortCollection[0];
Console.WriteLine("\nTotal number of ports before removing "
+ "a port '" + myPortTestRemove.Name +"' is : "
+ myService.Ports.Count);
myPortCollection.Remove(myPortTestRemove);
Console.WriteLine("Total number of ports after removing "
+ "a port '" + myPortTestRemove.Name +"' is : "
+ myService.Ports.Count);
// Create the WSDL file.
myPortCollection.Insert(0, myPortTestRemove);
myServiceDescription.Write("MathServiceItemNew_cs.wsdl");
Dim myService As Service
Dim myPortCollection As PortCollection
Dim myServiceDescription As ServiceDescription = _
ServiceDescription.Read("MathServiceItem_vb.wsdl")
Console.WriteLine("Total number of services : " & _
myServiceDescription.Services.Count.ToString)
Dim i As Integer
For i = 0 to myServiceDescription.Services.Count - 1
myService = myServiceDescription.Services(i)
Console.WriteLine("Name : " & myService.Name)
myPortCollection = myService.Ports
' Create an array of ports.
Console.WriteLine(ControlChars.NewLine & "Port collection :")
Dim i1 As Integer
For i1 = 0 to myService.Ports.Count - 1
Console.WriteLine("Port[" & i1.ToString & "] : " & _
myPortCollection(i1).Name)
Next
Dim strPort As String = myPortCollection(0).Name
Dim myPort As Port = myPortCollection(strPort)
Console.WriteLine(ControlChars.NewLine & _
"Index of Port[" & strPort & "] : " & _
myPortCollection.IndexOf(myPort).ToString)
Dim myPortTestRemove As Port = myPortCollection(0)
Console.WriteLine(ControlChars.NewLine & _
"Total number of ports before removing " & _
"a port '" & myPortTestRemove.Name & "' is : " & _
myService.Ports.Count.ToString)
myPortCollection.Remove(myPortTestRemove)
Console.WriteLine("Total number of ports after removing " & _
"a port '" & myPortTestRemove.Name & "' is : " & _
myService.Ports.Count.ToString)
' Create the WSDL file.
myPortCollection.Insert(0, myPortTestRemove)
myServiceDescription.Write("MathServiceItemNew_vb.wsdl")
Next
Propriedades
| Capacity |
Obtém ou define o número de elementos que o CollectionBase pode conter.Gets or sets the number of elements that the CollectionBase can contain. (Herdado de CollectionBase) |
| Count |
Obtém o número de elementos contidos na instância de CollectionBase.Gets the number of elements contained in the CollectionBase instance. Essa propriedade não pode ser substituída.This property cannot be overridden. (Herdado de CollectionBase) |
| InnerList |
Obtém uma ArrayList que contém a lista de elementos na instância de CollectionBase.Gets an ArrayList containing the list of elements in the CollectionBase instance. (Herdado de CollectionBase) |
| Item[Int32] |
Obtém ou define o valor de um Port no índice de base zero especificado.Gets or sets the value of a Port at the specified zero-based index. |
| Item[String] |
Obtém um especificado Port por seu nome.Gets a Port specified by its name. |
| List |
Obtém uma IList que contém a lista de elementos na instância de CollectionBase.Gets an IList containing the list of elements in the CollectionBase instance. (Herdado de CollectionBase) |
| Table |
Obtém uma interface que implementa a associação das chaves e valores no ServiceDescriptionBaseCollection.Gets an interface that implements the association of the keys and values in the ServiceDescriptionBaseCollection. (Herdado de ServiceDescriptionBaseCollection) |
Métodos
| Add(Port) |
Adiciona o Port especificado ao final do PortCollection.Adds the specified Port to the end of the PortCollection. |
| Clear() |
Remove todos os objetos da instância CollectionBase.Removes all objects from the CollectionBase instance. Esse método não pode ser substituído.This method cannot be overridden. (Herdado de CollectionBase) |
| Contains(Port) |
Retorna um valor que indica se o Port especificado é um membro do PortCollection.Returns a value indicating whether the specified Port is a member of the PortCollection. |
| CopyTo(Port[], Int32) |
Copia todo o PortCollection para uma matriz unidimensional do tipo Port, começando no índice de base zero especificado da matriz de destino.Copies the entire PortCollection to a one-dimensional array of type Port, starting at the specified zero-based index of the target array. |
| Equals(Object) |
Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object. (Herdado de Object) |
| GetEnumerator() |
Retorna um enumerador que itera pela instância CollectionBase.Returns an enumerator that iterates through the CollectionBase instance. (Herdado de CollectionBase) |
| GetHashCode() |
Serve como a função de hash padrão.Serves as the default hash function. (Herdado de Object) |
| GetKey(Object) |
Retorna o nome da chave associada com o valor passado por referência.Returns the name of the key associated with the value passed by reference. (Herdado de ServiceDescriptionBaseCollection) |
| GetType() |
Obtém o Type da instância atual.Gets the Type of the current instance. (Herdado de Object) |
| IndexOf(Port) |
Pesquisa o Port especificado e retorna o índice de base zero da primeira ocorrência dentro de toda a coleção.Searches for the specified Port and returns the zero-based index of the first occurrence within the collection. |
| Insert(Int32, Port) |
Adiciona a instância Port especificada ao PortCollection no índice especificado.Adds the specified Port instance to the PortCollection at the specified index. |
| MemberwiseClone() |
Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object. (Herdado de Object) |
| OnClear() |
Limpa o conteúdo da instância ServiceDescriptionBaseCollection.Clears the contents of the ServiceDescriptionBaseCollection instance. (Herdado de ServiceDescriptionBaseCollection) |
| OnClearComplete() |
Executa processos adicionais personalizados após limpar o conteúdo da instância CollectionBase.Performs additional custom processes after clearing the contents of the CollectionBase instance. (Herdado de CollectionBase) |
| OnInsert(Int32, Object) |
Executa os processos personalizados adicionais antes de inserir um novo elemento na instância CollectionBase.Performs additional custom processes before inserting a new element into the CollectionBase instance. (Herdado de CollectionBase) |
| OnInsertComplete(Int32, Object) |
Realiza processos personalizados adicionais após inserir um novo elemento no ServiceDescriptionBaseCollection.Performs additional custom processes after inserting a new element into the ServiceDescriptionBaseCollection. (Herdado de ServiceDescriptionBaseCollection) |
| OnRemove(Int32, Object) |
Remove um elemento do ServiceDescriptionBaseCollection.Removes an element from the ServiceDescriptionBaseCollection. (Herdado de ServiceDescriptionBaseCollection) |
| OnRemoveComplete(Int32, Object) |
Executa processos personalizados adicionais após remover um elemento da instância de CollectionBase.Performs additional custom processes after removing an element from the CollectionBase instance. (Herdado de CollectionBase) |
| OnSet(Int32, Object, Object) |
Substitui um valor por outro dentro do ServiceDescriptionBaseCollection.Replaces one value with another within the ServiceDescriptionBaseCollection. (Herdado de ServiceDescriptionBaseCollection) |
| OnSetComplete(Int32, Object, Object) |
Executa processos personalizados adicionais após configurar um valor na instância de CollectionBase.Performs additional custom processes after setting a value in the CollectionBase instance. (Herdado de CollectionBase) |
| OnValidate(Object) |
Executa processos personalizados adicionais ao validar um valor.Performs additional custom processes when validating a value. (Herdado de CollectionBase) |
| Remove(Port) |
Remove a primeira ocorrência do Port especificado do PortCollection.Removes the first occurrence of the specified Port from the PortCollection. |
| RemoveAt(Int32) |
Remove o elemento no índice especificado da instância CollectionBase.Removes the element at the specified index of the CollectionBase instance. Este método não é substituível.This method is not overridable. (Herdado de CollectionBase) |
| SetParent(Object, Object) |
Define o objeto pai da instância de ServiceDescriptionBaseCollection.Sets the parent object of the ServiceDescriptionBaseCollection instance. (Herdado de ServiceDescriptionBaseCollection) |
| ToString() |
Retorna uma cadeia de caracteres que representa o objeto atual.Returns a string that represents the current object. (Herdado de Object) |
Implantações explícitas de interface
| ICollection.CopyTo(Array, Int32) |
Copia todo o CollectionBase em um Array unidimensional compatível, começando no índice especificado da matriz de destino.Copies the entire CollectionBase to a compatible one-dimensional Array, starting at the specified index of the target array. (Herdado de CollectionBase) |
| ICollection.IsSynchronized |
Obtém um valor que indica se o acesso à CollectionBase é sincronizado (thread-safe).Gets a value indicating whether access to the CollectionBase is synchronized (thread safe). (Herdado de CollectionBase) |
| ICollection.SyncRoot |
Obtém um objeto que pode ser usado para sincronizar o acesso ao CollectionBase.Gets an object that can be used to synchronize access to the CollectionBase. (Herdado de CollectionBase) |
| IList.Add(Object) |
Adiciona um objeto ao final do CollectionBase.Adds an object to the end of the CollectionBase. (Herdado de CollectionBase) |
| IList.Contains(Object) |
Determina se o CollectionBase contém um elemento específico.Determines whether the CollectionBase contains a specific element. (Herdado de CollectionBase) |
| IList.IndexOf(Object) |
Pesquisa o Object especificado e retorna o índice de base zero da primeira ocorrência dentro de todo o CollectionBase.Searches for the specified Object and returns the zero-based index of the first occurrence within the entire CollectionBase. (Herdado de CollectionBase) |
| IList.Insert(Int32, Object) |
Insere um elemento no CollectionBase, no índice especificado.Inserts an element into the CollectionBase at the specified index. (Herdado de CollectionBase) |
| IList.IsFixedSize |
Obtém um valor que indica se o CollectionBase tem um tamanho fixo.Gets a value indicating whether the CollectionBase has a fixed size. (Herdado de CollectionBase) |
| IList.IsReadOnly |
Obtém um valor que indica se o CollectionBase é somente leitura.Gets a value indicating whether the CollectionBase is read-only. (Herdado de CollectionBase) |
| IList.Item[Int32] |
Obtém ou define o elemento no índice especificado.Gets or sets the element at the specified index. (Herdado de CollectionBase) |
| IList.Remove(Object) |
Remove a primeira ocorrência de um objeto específico do CollectionBase.Removes the first occurrence of a specific object from the CollectionBase. (Herdado de CollectionBase) |
Métodos de Extensão
| Cast<TResult>(IEnumerable) |
Converte os elementos de um IEnumerable para o tipo especificado.Casts the elements of an IEnumerable to the specified type. |
| OfType<TResult>(IEnumerable) |
Filtra os elementos de um IEnumerable com base em um tipo especificado.Filters the elements of an IEnumerable based on a specified type. |
| AsParallel(IEnumerable) |
Habilita a paralelização de uma consulta.Enables parallelization of a query. |
| AsQueryable(IEnumerable) |
Converte um IEnumerable em um IQueryable.Converts an IEnumerable to an IQueryable. |