War diese Seite hilfreich?
Ihr Feedback ist uns wichtig. Teilen Sie uns Ihre Meinung mit.
Weiteres Feedback?
1500 verbleibende Zeichen
Exportieren (0) Drucken
Alle erweitern

SoapHeaderCollection.IndexOf-Methode

Bestimmt den Index von SoapHeader in SoapHeaderCollection.

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

public int IndexOf (
	SoapHeader header
)
public int IndexOf (
	SoapHeader header
)
public function IndexOf (
	header : SoapHeader
) : int

Parameter

header

Der SoapHeader, der in SoapHeaderCollection gesucht werden soll.

Rückgabewert

Der Index des header-Parameters, sofern in SoapHeaderCollection vorhanden ist, andernfalls -1.

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

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0
Anzeigen:
© 2015 Microsoft