PortCollection Classe
Definizione
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
- Ereditarietà
Esempio
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
Proprietà
Capacity |
Ottiene o imposta il numero di elementi che CollectionBase può contenere.Gets or sets the number of elements that the CollectionBase can contain. (Ereditato da CollectionBase) |
Count |
Ottiene il numero di elementi contenuti nell'istanza di CollectionBase.Gets the number of elements contained in the CollectionBase instance. Questa proprietà non può essere sottoposta a override.This property cannot be overridden. (Ereditato da CollectionBase) |
InnerList |
Ottiene un ArrayList contenente l'elenco degli elementi presenti nell'istanza CollectionBase.Gets an ArrayList containing the list of elements in the CollectionBase instance. (Ereditato da CollectionBase) |
Item[Int32] |
Ottiene o imposta il valore di un oggetto Port in corrispondenza dell'indice in base zero specificato.Gets or sets the value of a Port at the specified zero-based index. |
Item[String] |
Ottiene un oggetto Port specificato in base al nome.Gets a Port specified by its name. |
List |
Ottiene un IList contenente l'elenco degli elementi presenti nell'istanza CollectionBase.Gets an IList containing the list of elements in the CollectionBase instance. (Ereditato da CollectionBase) |
Table |
Ottiene un'interfaccia che implementa l'associazione delle chiavi e dei valori in ServiceDescriptionBaseCollection.Gets an interface that implements the association of the keys and values in the ServiceDescriptionBaseCollection. (Ereditato da ServiceDescriptionBaseCollection) |
Metodi
Add(Port) |
Aggiunge l'oggetto Port specificato alla fine di PortCollection.Adds the specified Port to the end of the PortCollection. |
Clear() |
Consente di rimuovere tutti gli oggetti dall'istanza CollectionBase.Removes all objects from the CollectionBase instance. Questo metodo non può essere sottoposto a override.This method cannot be overridden. (Ereditato da CollectionBase) |
Contains(Port) |
Restituisce un valore che indica se l'oggetto Port specificato è un membro di PortCollection.Returns a value indicating whether the specified Port is a member of the PortCollection. |
CopyTo(Port[], Int32) |
Copia l'intero oggetto PortCollection in una matrice unidimensionale di tipo Port, a partire dall'indice in base zero specificato della matrice di destinazione.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 l'oggetto specificato è uguale all'oggetto corrente.Determines whether the specified object is equal to the current object. (Ereditato da Object) |
GetEnumerator() |
Restituisce un enumeratore per lo scorrimento dell'istanza di CollectionBase.Returns an enumerator that iterates through the CollectionBase instance. (Ereditato da CollectionBase) |
GetHashCode() |
Funge da funzione hash predefinita.Serves as the default hash function. (Ereditato da Object) |
GetKey(Object) |
Restituisce il nome della chiave associata al valore passato per riferimento.Returns the name of the key associated with the value passed by reference. (Ereditato da ServiceDescriptionBaseCollection) |
GetType() |
Ottiene l'oggetto Type dell'istanza corrente.Gets the Type of the current instance. (Ereditato da Object) |
IndexOf(Port) |
Cerca l'oggetto Port specificato e restituisce l'indice in base zero della prima occorrenza all'interno dell'insieme.Searches for the specified Port and returns the zero-based index of the first occurrence within the collection. |
Insert(Int32, Port) |
Aggiunge l'oggetto Port specificato a PortCollection in corrispondenza dell'indice specificato.Adds the specified Port instance to the PortCollection at the specified index. |
MemberwiseClone() |
Crea una copia superficiale dell'oggetto Object corrente.Creates a shallow copy of the current Object. (Ereditato da Object) |
OnClear() |
Cancella il contenuto dell'istanza di ServiceDescriptionBaseCollection.Clears the contents of the ServiceDescriptionBaseCollection instance. (Ereditato da ServiceDescriptionBaseCollection) |
OnClearComplete() |
Esegue procedure personalizzate aggiuntive prima di cancellare il contenuto dell'istanza di CollectionBase.Performs additional custom processes after clearing the contents of the CollectionBase instance. (Ereditato da CollectionBase) |
OnInsert(Int32, Object) |
Esegue procedure personalizzate aggiuntive prima di inserire un nuovo elemento nell'istanza di CollectionBase.Performs additional custom processes before inserting a new element into the CollectionBase instance. (Ereditato da CollectionBase) |
OnInsertComplete(Int32, Object) |
Esegue procedure personalizzate aggiuntive dopo l'inserimento di un nuovo elemento in ServiceDescriptionBaseCollection.Performs additional custom processes after inserting a new element into the ServiceDescriptionBaseCollection. (Ereditato da ServiceDescriptionBaseCollection) |
OnRemove(Int32, Object) |
Rimuove un elemento da ServiceDescriptionBaseCollection.Removes an element from the ServiceDescriptionBaseCollection. (Ereditato da ServiceDescriptionBaseCollection) |
OnRemoveComplete(Int32, Object) |
Esegue procedure personalizzate aggiuntive dopo della rimozione di un elemento dall'istanza di CollectionBase.Performs additional custom processes after removing an element from the CollectionBase instance. (Ereditato da CollectionBase) |
OnSet(Int32, Object, Object) |
Sostituisce un valore con un altro valore all'interno di ServiceDescriptionBaseCollection.Replaces one value with another within the ServiceDescriptionBaseCollection. (Ereditato da ServiceDescriptionBaseCollection) |
OnSetComplete(Int32, Object, Object) |
Esegue procedure personalizzate aggiuntive dopo aver impostato un valore nell'istanza di CollectionBase.Performs additional custom processes after setting a value in the CollectionBase instance. (Ereditato da CollectionBase) |
OnValidate(Object) |
Esegue processi personalizzati aggiuntivi durante la convalida di un valore.Performs additional custom processes when validating a value. (Ereditato da CollectionBase) |
Remove(Port) |
Rimuove la prima occorrenza dell'oggetto Port specificato da PortCollection.Removes the first occurrence of the specified Port from the PortCollection. |
RemoveAt(Int32) |
Consente di rimuovere la voce in corrispondenza dell'indice specificato dell'istanza CollectionBase.Removes the element at the specified index of the CollectionBase instance. Questo metodo non può essere sottoposto a override.This method is not overridable. (Ereditato da CollectionBase) |
SetParent(Object, Object) |
Imposta l'oggetto padre dell'istanza di ServiceDescriptionBaseCollection.Sets the parent object of the ServiceDescriptionBaseCollection instance. (Ereditato da ServiceDescriptionBaseCollection) |
ToString() |
Restituisce una stringa che rappresenta l'oggetto corrente.Returns a string that represents the current object. (Ereditato da Object) |
Implementazioni dell'interfaccia esplicita
ICollection.CopyTo(Array, Int32) |
Copia l'intero oggetto CollectionBase in un oggetto Array compatibile unidimensionale, a partire dall'indice specificato della matrice di destinazione.Copies the entire CollectionBase to a compatible one-dimensional Array, starting at the specified index of the target array. (Ereditato da CollectionBase) |
ICollection.IsSynchronized |
Ottiene un valore che indica se l'accesso a CollectionBase è sincronizzato (thread-safe).Gets a value indicating whether access to the CollectionBase is synchronized (thread safe). (Ereditato da CollectionBase) |
ICollection.SyncRoot |
Ottiene un oggetto che può essere usato per sincronizzare l'accesso a CollectionBase.Gets an object that can be used to synchronize access to the CollectionBase. (Ereditato da CollectionBase) |
IList.Add(Object) |
Aggiunge un oggetto alla fine di CollectionBase.Adds an object to the end of the CollectionBase. (Ereditato da CollectionBase) |
IList.Contains(Object) |
Consente di stabilire se CollectionBase contiene un elemento specifico.Determines whether the CollectionBase contains a specific element. (Ereditato da CollectionBase) |
IList.IndexOf(Object) |
Cerca l'oggetto Object specificato e restituisce l'indice in base zero della prima occorrenza all'interno dell'intero CollectionBase.Searches for the specified Object and returns the zero-based index of the first occurrence within the entire CollectionBase. (Ereditato da CollectionBase) |
IList.Insert(Int32, Object) |
Inserisce un elemento in CollectionBase in corrispondenza dell'indice specificato.Inserts an element into the CollectionBase at the specified index. (Ereditato da CollectionBase) |
IList.IsFixedSize |
Ottiene un valore che indica se CollectionBase ha dimensioni fisse.Gets a value indicating whether the CollectionBase has a fixed size. (Ereditato da CollectionBase) |
IList.IsReadOnly |
Ottiene un valore che indica se CollectionBase è di sola lettura.Gets a value indicating whether the CollectionBase is read-only. (Ereditato da CollectionBase) |
IList.Item[Int32] |
Ottiene o imposta l'elemento in corrispondenza dell'indice specificato.Gets or sets the element at the specified index. (Ereditato da CollectionBase) |
IList.Remove(Object) |
Rimuove la prima occorrenza di un oggetto specifico da CollectionBase.Removes the first occurrence of a specific object from the CollectionBase. (Ereditato da CollectionBase) |
Metodi di estensione
Cast<TResult>(IEnumerable) |
Esegue il cast degli elementi di un oggetto IEnumerable nel tipo specificato.Casts the elements of an IEnumerable to the specified type. |
OfType<TResult>(IEnumerable) |
Filtra gli elementi di un oggetto IEnumerable in base a un tipo specificato.Filters the elements of an IEnumerable based on a specified type. |
AsParallel(IEnumerable) |
Consente la parallelizzazione di una query.Enables parallelization of a query. |
AsQueryable(IEnumerable) |
Converte un oggetto IEnumerable in un oggetto IQueryable.Converts an IEnumerable to an IQueryable. |