本文介绍了无用?是DirectorySearcher.PropertiesToLoad UseLess?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要进行健全性检查b / c我可能误解了PropertiesToLoad的用途。

有没有其他人注意到无论你添加到DirectorySearcher.PropertiesToLoad中的属性名称数量多少​​,生成的DirectoryEntry PropertiesCollection将包含所有属性,而不仅仅是你告诉它的属性?无论我是否使用PropertiesToLoad,返回的数字(对我来说都是一样的。)
ie:

I need a sanity check b/c maybe i've misunderstood the purpose of PropertiesToLoad.

Has anyone else noticed that regardless of the number of property names you add into DirectorySearcher.PropertiesToLoad, the resulting DirectoryEntry PropertiesCollection will contain all the properties, not just the ones you told it to get? The number returned (for me) is the same whether or not I use PropertiesToLoad.

ie:

使用 (DirectorySearcher searcher = new DirectorySearcher()){
// searcher.CacheResults = false;值没有区别
// searcher.PropertiesToLoad.C​​lear();没有区别
searcher.PropertiesToLoad.Add(" mail" ;
searcher.PropertiesToLoad.Add(" displayName" ;
searcher.Filter = filter;
信息搜索结果结果= searcher.FindOne();
DirectoryEntry entry = result.GetDirectoryEntry();
Console.WriteLine(entry.Properties.Count.ToString());
}
using ( DirectorySearcher searcher = new DirectorySearcher() ) { 
    //searcher.CacheResults = false; value makes no difference 
    //searcher.PropertiesToLoad.Clear(); makes no difference 
    searcher.PropertiesToLoad.Add( "mail" )
    searcher.PropertiesToLoad.Add( "displayName" )
    searcher.Filter = filter; 
    SearchResult result = searcher.FindOne(); 
    DirectoryEntry entry = result.GetDirectoryEntry(); 
    Console.WriteLine( entry.Properties.Count.ToString() ); 

推荐答案


这篇关于无用?是DirectorySearcher.PropertiesToLoad UseLess?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 23:59