SearchResult.Properties Свойство

Определение

Возвращает коллекцию свойств ResultPropertyCollection для данного объекта.

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

Значение свойства

ResultPropertyCollection — коллекция свойств, установленных для данного объекта.

Примеры

Следующий пример представляет собой выдержку из примера в SearchResult. В исходном примере создается новый DirectoryEntry объект с нужным путем FindOne и используется метод для запуска поиска. После выполнения поиска в примере используется GetDirectoryEntry метод для получения записи динамического каталога, которая указана в результатах поиска.

В этом примере результат поиска помещается в ResultPropertyCollection. Затем каждое свойство отображается в окне консоли.

' 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);  
    }  
}  

Комментарии

Эта коллекция содержит только свойства, которые были явно запрошены через DirectorySearcher.PropertiesToLoad.

Применяется к