The code could be made more efficient by using the PageSize and PagedResults properties of the DirectorySearcher object.
The PageSize property specifies the number of objects returned in a single page of results while the PagedResults property specifies the number of objects returned in a single search request. Using these properties can help you optimize your code by reducing the number of round trips to the server and the amount of data transferred between the client and server.
The code could be made more efficient by using the PageSize and PagedResults properties of the DirectorySearcher object.
The PageSize property specifies the number of objects returned in a single page of results while the PagedResults property specifies the number of objects returned in a single search request. Using these properties can help you optimize your code by reducing the number of round trips to the server and the amount of data transferred between the client and server.