SoapHeaderCollection.Item[Int32] 속성

정의

SoapHeader의 지정된 인덱스에 있는 SoapHeaderCollection를 가져오거나 설정합니다.

public:
 property System::Web::Services::Protocols::SoapHeader ^ default[int] { System::Web::Services::Protocols::SoapHeader ^ get(int index); void set(int index, System::Web::Services::Protocols::SoapHeader ^ value); };
public System.Web.Services.Protocols.SoapHeader this[int index] { get; set; }
member this.Item(int) : System.Web.Services.Protocols.SoapHeader with get, set
Default Public Property Item(index As Integer) As SoapHeader

매개 변수

index
Int32

가져오거나 설정할 SoapHeader의 인덱스(0부터 시작)입니다.

속성 값

SoapHeader

지정한 인덱스에 있는 SoapHeader입니다.

예외

index 매개 변수는 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
        [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

설명

이 속성은 myCollection[index] 구문을 사용하여 컬렉션의 특정 요소에 액세스하는 기능을 제공합니다.

적용 대상