Bagikan melalui


SearchResult.Properties Properti

Definisi

ResultPropertyCollection Mendapatkan kumpulan properti untuk objek ini.

public:
 property System::DirectoryServices::ResultPropertyCollection ^ Properties { System::DirectoryServices::ResultPropertyCollection ^ get(); };
public System.DirectoryServices.ResultPropertyCollection Properties { get; }
member this.Properties : System.DirectoryServices.ResultPropertyCollection
Public ReadOnly Property Properties As ResultPropertyCollection

Nilai Properti

Properti ResultPropertyCollection yang disetel pada objek ini.

Contoh

Contoh berikut adalah kutipan contoh di SearchResult. Contoh asli membuat objek baru DirectoryEntry dengan jalur yang diinginkan dan menggunakan FindOne metode untuk memulai pencarian. Setelah melakukan pencarian, contohnya menggunakan GetDirectoryEntry metode untuk mengambil entri direktori langsung yang diidentifikasi dalam hasil pencarian.

Dalam contoh ini, hasil pencarian dimasukkan ke dalam ResultPropertyCollection. Kemudian, setiap properti ditampilkan ke jendela konsol.

' Get the properties for 'mySearchResult'.  
Dim myResultPropColl As ResultPropertyCollection  
myResultPropColl = mySearchResult.Properties  
Console.WriteLine("The properties of the 'mySearchResult' are :")  
Dim myKey As String  
For Each myKey In  myResultPropColl.PropertyNames  
   Dim tab1 As String = "    "  
   Console.WriteLine(myKey + " = ")  
   Dim myCollection As Object  
   For Each myCollection In  myResultPropColl(myKey)  
      Console.WriteLine(tab1 + myCollection)  
   Next myCollection  
Next myKey  
// Get the properties for 'mySearchResult'.  
ResultPropertyCollection myResultPropColl;  
myResultPropColl = mySearchResult.Properties;  
Console.WriteLine("The properties of the " +   
                  "'mySearchResult' are :");  
foreach( string myKey in myResultPropColl.PropertyNames)  
{  
   string tab = "    ";  
   Console.WriteLine(myKey + " = ");  
   foreach( Object myCollection in myResultPropColl[myKey])  
   {  
      Console.WriteLine(tab + myCollection);  
   }  
}  
// Get the properties for 'mySearchResult'.  
ResultPropertyCollection^ myResultPropColl = mySearchResult->Properties;  
Console::WriteLine("The properties of the 'mySearchResult' are :");  
IEnumerator^ myEnum = myResultPropColl->PropertyNames->GetEnumerator();  
while (myEnum->MoveNext())   
{  
    String^ myKey = safe_cast<String^>(myEnum->Current);  
    Console::WriteLine("{0} = ", myKey);  
    IEnumerator^ myEnum = myResultPropColl->Item[myKey]->GetEnumerator();  
    while (myEnum->MoveNext())   
    {  
        Console::WriteLine("\t{0}", myEnum->Current);  
    }  
}  

Keterangan

Koleksi ini hanya berisi properti yang diminta secara eksplisit melalui DirectorySearcher.PropertiesToLoad.

Berlaku untuk