语言

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

注解

此集合仅包含通过显式请求 DirectorySearcher.PropertiesToLoad的属性。

适用于