I think that will fix you.

In a lot of cases, a pattern like this is assumed to be faster:

For x = 0 to coll.Count - 1
        'do something on coll(x)....
Next

But in the case of the DirectorySearcher, this is definitely the worst possible 
thing you can do.

For Each x in coll
        'do something with x
Next

Is the way to go.  Same thing in C#, different syntax.  The downside is that 
you don't know how many results you'll get until you are done enumerating, but 
normally you don't really care about that anyway.
 
The docs should probably mention this.  :)

Joe K.


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mikael H�kansson
Sent: Thursday, March 03, 2005 1:06 PM
To: [email protected]
Subject: Re: [ActiveDir] DirectoryServices: Paged searches

Ok, the first I will do is removing the .Count line =)

Unfortunately I can�t wait for .Net 2.0

Thanks
Mikael H�kansson



This message is for the designated recipient only and may contain privileged, 
proprietary, or otherwise private information.  If you have received it in 
error, please notify the sender immediately and delete the original.  Any other 
use of the email by you is prohibited.
List info   : http://www.activedir.org/List.aspx
List FAQ    : http://www.activedir.org/ListFAQ.aspx
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

Reply via email to