SoapHeaderCollection.Contains(SoapHeader) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
SoapHeaderCollection に特定の SoapHeader が格納されているかどうかを確認します。
public:
bool Contains(System::Web::Services::Protocols::SoapHeader ^ header);
public bool Contains (System.Web.Services.Protocols.SoapHeader header);
member this.Contains : System.Web.Services.Protocols.SoapHeader -> bool
Public Function Contains (header As SoapHeader) As Boolean
パラメーター
- header
- SoapHeader
SoapHeaderCollection 内で検索される SoapHeader。
戻り値
header
パラメーターの値が SoapHeaderCollection に存在する場合は true
。それ以外の場合は false
。
例
// Check to see whether the collection contains mySecondSoapHeader.
if ( mySoapHeaderCollection->Contains( mySecondSoapHeader ) )
{
// Get the index of mySecondSoapHeader from the collection.
Console::WriteLine( "Index of mySecondSoapHeader: {0}", mySoapHeaderCollection->IndexOf( mySecondSoapHeader ) );
// Get the SoapHeader from the collection.
MySoapHeader^ mySoapHeader1 = dynamic_cast<MySoapHeader^>(mySoapHeaderCollection[ mySoapHeaderCollection->IndexOf( mySecondSoapHeader ) ]);
Console::WriteLine( "SoapHeader retrieved from the collection: {0}", mySoapHeader1 );
// Remove a SoapHeader from the collection.
mySoapHeaderCollection->Remove( mySoapHeader1 );
Console::WriteLine( "Number of items after removal: {0}", mySoapHeaderCollection->Count );
}
else
Console::WriteLine( "mySoapHeaderCollection does not contain mySecondSoapHeader." );
// Check to see whether the collection contains mySecondSoapHeader.
if(mySoapHeaderCollection.Contains(mySecondSoapHeader))
{
// Get the index of mySecondSoapHeader from the collection.
Console.WriteLine("Index of mySecondSoapHeader: " +
mySoapHeaderCollection.IndexOf(mySecondSoapHeader));
// Get the SoapHeader from the collection.
MySoapHeader mySoapHeader1 = (MySoapHeader)mySoapHeaderCollection
[mySoapHeaderCollection.IndexOf(mySecondSoapHeader)];
Console.WriteLine("SoapHeader retrieved from the collection: "
+ mySoapHeader1);
// Remove a SoapHeader from the collection.
mySoapHeaderCollection.Remove(mySoapHeader1);
Console.WriteLine("Number of items after removal: {0}",
mySoapHeaderCollection.Count);
}
else
Console.WriteLine(
"mySoapHeaderCollection does not contain mySecondSoapHeader.");
' Check to see whether the collection contains mySecondSoapHeader.
If mySoapHeaderCollection.Contains(mySecondSoapHeader) Then
' Get the index of mySecondSoapHeader from the collection.
Console.WriteLine("Index of mySecondSoapHeader: " & _
mySoapHeaderCollection.IndexOf(mySecondSoapHeader).ToString())
' Get the SoapHeader from the collection.
Dim mySoapHeader1 As MySoapHeader = CType(mySoapHeaderCollection( _
mySoapHeaderCollection.IndexOf(mySecondSoapHeader)), _
MySoapHeader)
Console.WriteLine("SoapHeader retrieved from the collection: " _
& mySoapHeader1.ToString())
' Remove a SoapHeader from the collection.
mySoapHeaderCollection.Remove(mySoapHeader1)
Console.WriteLine("Number of items after removal: {0}", _
& mySoapHeaderCollection.Count)
Else
Console.WriteLine( _
"mySoapHeaderCollection does not contain mySecondSoapHeader.")
End If