PortTypeCollection.Contains(PortType) Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Restituisce un valore che indica se l'oggetto PortType specificato è un membro di PortTypeCollection.
public:
bool Contains(System::Web::Services::Description::PortType ^ portType);
public bool Contains (System.Web.Services.Description.PortType portType);
member this.Contains : System.Web.Services.Description.PortType -> bool
Public Function Contains (portType As PortType) As Boolean
Parametri
Restituisce
true
se il parametro portType
è un membro di PortTypeCollection. In caso contrario, false
.
Esempio
ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_CS.wsdl" );
PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes;
int noOfPortTypes = myServiceDescription->PortTypes->Count;
Console::WriteLine( "\nTotal number of PortTypes: {0}", noOfPortTypes );
PortType^ myNewPortType = myPortTypeCollection[ "MathServiceSoap" ];
// Get the index in the collection.
int index = myPortTypeCollection->IndexOf( myNewPortType );
Console::WriteLine( "Removing the PortType named {0}", myNewPortType->Name );
// Remove the PortType from the collection.
myPortTypeCollection->Remove( myNewPortType );
noOfPortTypes = myServiceDescription->PortTypes->Count;
Console::WriteLine( "\nTotal number of PortTypes: {0}", noOfPortTypes );
// Check whether the PortType exists in the collection.
bool bContains = myPortTypeCollection->Contains( myNewPortType );
Console::WriteLine( "Port Type'{0}' exists: {1}", myNewPortType->Name, bContains );
Console::WriteLine( "Adding the PortType" );
// Insert a new portType at the index location.
myPortTypeCollection->Insert( index, 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 );
bContains = myPortTypeCollection->Contains( myNewPortType );
Console::WriteLine( "Port Type'{0}' exists: {1}", myNewPortType->Name, bContains );
myServiceDescription->Write( "MathService_New.wsdl" );
ServiceDescription myServiceDescription =
ServiceDescription.Read("MathService_CS.wsdl");
PortTypeCollection myPortTypeCollection =
myServiceDescription.PortTypes;
int noOfPortTypes = myServiceDescription.PortTypes.Count;
Console.WriteLine("\nTotal number of PortTypes: " + noOfPortTypes);
PortType myNewPortType = myPortTypeCollection["MathServiceSoap"];
// Get the index in the collection.
int index = myPortTypeCollection.IndexOf(myNewPortType);
Console.WriteLine("Removing the PortType named "
+ myNewPortType.Name);
// Remove the PortType from the collection.
myPortTypeCollection.Remove(myNewPortType);
noOfPortTypes = myServiceDescription.PortTypes.Count;
Console.WriteLine("\nTotal number of PortTypes: "
+ noOfPortTypes);
// Check whether the PortType exists in the collection.
bool bContains = myPortTypeCollection.Contains(myNewPortType);
Console.WriteLine("Port Type'" + myNewPortType.Name + "' exists: "
+ bContains );
Console.WriteLine("Adding the PortType");
// Insert a new portType at the index location.
myPortTypeCollection.Insert(index, myNewPortType);
// Display the number of portTypes after adding a port.
Console.WriteLine("Total number of PortTypes after "
+ "adding a new port: " + myServiceDescription.PortTypes.Count);
bContains = myPortTypeCollection.Contains(myNewPortType);
Console.WriteLine("Port Type'" + myNewPortType.Name + "' exists: "
+ bContains );
myServiceDescription.Write("MathService_New.wsdl");
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: " & noOfPortTypes.ToString())
Dim myNewPortType As PortType = myPortTypeCollection("MathServiceSoap")
' Get the index in the collection.
Dim index As Integer = myPortTypeCollection.IndexOf(myNewPortType)
Console.WriteLine("Removing the PortType named " & _
myNewPortType.Name)
' Remove the PortType from the collection.
myPortTypeCollection.Remove(myNewPortType)
noOfPortTypes = myServiceDescription.PortTypes.Count
Console.WriteLine(ControlChars.Newline & _
"Total number of PortTypes: " & noOfPortTypes.ToString())
' Check whether the PortType exists in the collection.
Dim bContains As Boolean = myPortTypeCollection.Contains(myNewPortType)
Console.WriteLine("Port Type'" & myNewPortType.Name & _
"' exists: " & bContains.ToString())
Console.WriteLine("Adding the 'PortType'")
' Insert a new portType at the index location.
myPortTypeCollection.Insert(index, 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())
bContains = myPortTypeCollection.Contains(myNewPortType)
Console.WriteLine("Port Type'" & myNewPortType.Name & "' exists: " _
& bContains.ToString())
myServiceDescription.Write("MathService_New.wsdl")
Si applica a
Collabora con noi su GitHub
L'origine di questo contenuto è disponibile in GitHub, in cui è anche possibile creare ed esaminare i problemi e le richieste pull. Per ulteriori informazioni, vedere la guida per i collaboratori.