語言

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 A 是設定在這個物件上的屬性。

範例

以下範例為 中 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的屬性。

適用於