PortTypeCollection.Contains メソッド
指定した PortType が PortTypeCollection のメンバかどうかを示す値を返します。
Public Function Contains( _
ByVal portType As PortType _) As Boolean
[C#]
public bool Contains(PortTypeportType);
[C++]
public: bool Contains(PortType* portType);
[JScript]
public function Contains(
portType : PortType) : Boolean;
パラメータ
- portType
コレクション メンバシップを確認する対象となる PortType 。
戻り値
portType パラメータが PortTypeCollection のメンバである場合は true 。それ以外の場合は false 。
使用例
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")
[C#]
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");
[C++]
ServiceDescription* myServiceDescription =
ServiceDescription::Read(S"MathService_CS.wsdl");
PortTypeCollection* myPortTypeCollection =
myServiceDescription->PortTypes;
int noOfPortTypes = myServiceDescription->PortTypes->Count;
Console::WriteLine(S"\nTotal number of PortTypes: {0}", __box(noOfPortTypes));
PortType* myNewPortType = myPortTypeCollection->Item[S"MathServiceSoap"];
// Get the index in the collection.
int index = myPortTypeCollection->IndexOf(myNewPortType);
Console::WriteLine(S"Removing the PortType named {0}", myNewPortType->Name);
// Remove the PortType from the collection.
myPortTypeCollection->Remove(myNewPortType);
noOfPortTypes = myServiceDescription->PortTypes->Count;
Console::WriteLine(S"\nTotal number of PortTypes: {0}", __box(noOfPortTypes));
// Check whether the PortType exists in the collection.
bool bContains = myPortTypeCollection->Contains(myNewPortType);
Console::WriteLine(S"Port Type'{0}' exists: {1}", myNewPortType->Name, __box(bContains));
Console::WriteLine(S"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(S"Total number of PortTypes after adding a new port: {0}", __box(myServiceDescription->PortTypes->Count));
bContains = myPortTypeCollection->Contains(myNewPortType);
Console::WriteLine(S"Port Type'{0}' exists: {1}", myNewPortType->Name, __box(bContains));
myServiceDescription->Write(S"MathService_New.wsdl");
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
PortTypeCollection クラス | PortTypeCollection メンバ | System.Web.Services.Description 名前空間