Search

Sıralı liste içinde, belirtilen kritere eşit olan bir eleman arar.

CObject*  Search(
   CObject*  element      // örnek
   )

Parametreler

element

[in] Dizi içinde aranacak elemanın örneği.

Dönüş Değeri

Başarılı ise bulunan elemanın işaretçisine, aksi durumda NULL değerine dönüş yapar.

Örnek:

//--- CList::Search(CObject*) için bir örnek
#include <Arrays\List.mqh> 
//--- 
void OnStart() 
  { 
   CList *list=new CList; 
   //--- 
   if(list==NULL
     { 
      printf("Nesne oluşturma hatası"); 
      return
     } 
   //--- iste elemanları ekle 
   //--- . . . 
   //--- listeyi sırala 
   list.Sort(0); 
   //--- liste örnek oluştur 
   CObject *sample=new CObject; 
   if(sample==NULL
     { 
      printf("Örnek oluşturma hatası"); 
      delete list; 
      return
     } 
   //--- örnek özelliklerini ayarla 
   //--- . . . 
   //--- eleman ara 
   if(list.Search(sample)!=NULLprintf("Eleman bulundu"); 
   else                          printf("Eleman bulunamadı"); 
   //--- listeyi sil 
   delete list; 
  }