SoapHeaderCollection.Remove Method
.NET Framework 3.0
Removes the first occurrence of a specific SoapHeader from the SoapHeaderCollection.
Namespace: System.Web.Services.Protocols
Assembly: System.Web.Services (in system.web.services.dll)
Assembly: System.Web.Services (in system.web.services.dll)
public void Remove ( SoapHeader header )
public function Remove ( header : SoapHeader )
Not applicable.
Parameters
- header
The SoapHeader to remove from the SoapHeaderCollection.
// 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.
get_Item(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}",
System.Convert.ToString(mySoapHeaderCollection.get_Count()));
}
else {
Console.WriteLine("mySoapHeaderCollection does not contain "
+ "mySecondSoapHeader.");
}
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.Community Additions
ADD
Show: