Diese Dokumentation wurde archiviert und wird nicht länger gepflegt.

SoapHeaderCollection.Remove-Methode

Aktualisiert: November 2007

Entfernt das erste Vorkommen eines bestimmten SoapHeader in der SoapHeaderCollection.

Namespace:  System.Web.Services.Protocols
Assembly:  System.Web.Services (in System.Web.Services.dll)

public void Remove(
	SoapHeader header
)
public void Remove(
	SoapHeader header
)
public function Remove(
	header : SoapHeader
)

Parameter

header
Typ: System.Web.Services.Protocols.SoapHeader
Der SoapHeader, der aus der SoapHeaderCollection entfernt werden soll.

Die SoapHeader-Elemente, die an die Stelle des entfernten SoapHeader rücken, um die freie Stelle zu schließen.

// 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)) {
    // 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 Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile für Smartphone, Windows Mobile für Pocket PC

.NET Framework und .NET Compact Framework unterstützen nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen für .NET Framework.

.NET Framework

Unterstützt in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 3.5, 2.0, 1.0
Anzeigen: