다음을 통해 공유


ImportCollection.IndexOf(Import) 메서드

정의

컬렉션에서 지정된 Import을 검색하여 처음 나오는 항목의 인덱스(0부터 시작)를 반환합니다.

public:
 int IndexOf(System::Web::Services::Description::Import ^ import);
public int IndexOf (System.Web.Services.Description.Import import);
member this.IndexOf : System.Web.Services.Description.Import -> int
Public Function IndexOf (import As Import) As Integer

매개 변수

import
Import

컬렉션에서 검색할 Import입니다.

반환

Int32

32비트 부호 있는 정수입니다.

예제

다음 예제에서는 IndexOf 메서드를 사용하는 방법을 보여 줍니다.

// Get Import by Index.
Import^ myImport = myServiceDescription->Imports[ myServiceDescription->Imports->Count - 1 ];
Console::WriteLine( "Import by Index..." );
if ( myImportCollection->Contains( myImport ) )
{
   Console::WriteLine( "Import Namespace ' {0} ' is found in 'ImportCollection'.", myImport->Namespace );
   Console::WriteLine( "Index of '{0}' in 'ImportCollection' = {1}",
      myImport->Namespace, myImportCollection->IndexOf( myImport ) );
   Console::WriteLine( "Deleting Import from 'ImportCollection'..." );
   myImportCollection->Remove( myImport );
   if ( myImportCollection->IndexOf( myImport ) == -1 )
         Console::WriteLine( "Import is successfully removed from Import Collection." );
}
// Get Import by Index.
Import myImport = myServiceDescription.Imports[myServiceDescription.Imports.Count-1];
Console.WriteLine("Import by Index...");
if (myImportCollection.Contains(myImport))
{
   Console.WriteLine("Import Namespace '"
            + myImport.Namespace + "' is found in 'ImportCollection'.");
   Console.WriteLine("Index of '" + myImport.Namespace + "' in 'ImportCollection' = "
                                             + myImportCollection.IndexOf(myImport));
   Console.WriteLine("Deleting Import from 'ImportCollection'...");
   myImportCollection.Remove(myImport);
   if(myImportCollection.IndexOf(myImport) == -1)
      Console.WriteLine("Import is successfully removed from Import Collection.");
}
' Get Import by Index.
Dim myImport As Import = _
      myServiceDescription.Imports(myServiceDescription.Imports.Count - 1)

Console.WriteLine("Import by Index...")
If myImportCollection.Contains(myImport) Then
   Console.WriteLine("Import Namespace '" + myImport.Namespace + _
                     "' is found in 'ImportCollection'.")
   Console.WriteLine("Index of '" + myImport.Namespace + _
                     "' in 'ImportCollection' = " + _
                     myImportCollection.IndexOf(myImport).ToString())
   Console.WriteLine("Delete Import from 'ImportCollection'...")
   myImportCollection.Remove(myImport)
   If myImportCollection.IndexOf(myImport) = - 1 Then
      Console.WriteLine("Import is successfully removed from Import Collection.")
   End If

적용 대상