Aracılığıyla paylaş


ImportCollection.IndexOf(Import) Yöntem

Tanım

Belirtilen Import öğesini arar ve koleksiyondaki ilk oluşumun sıfır tabanlı dizinini döndürür.

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

Parametreler

import
Import

Import Koleksiyonda aranacak olan.

Döndürülenler

32 bit işaretli bir tamsayı.

Örnekler

Aşağıdaki örnekte yönteminin kullanımı gösterilmektedir 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

Şunlara uygulanır