It seems to me that you always need to properly manage resources when calling the Directory Services API without any exceptions (but many examples, blogs and manuals are often ignored or make one way with this call and the other with another call). Since all of the following DS classes implement the Dispose method, so I just want to confirm once and for all:
using (DirectoryEntry dirEntry = new DirectoryEntry()) { using (DirectorySearcher dirSearcher = new DirectorySearcher()) { dirSearcher.SearchRoot = dirEntry; dirSearcher.Filter = ...; using (SearchResultCollection src = dirSearcher.FindAll()) {
always have to do. Do I face any risk, always systematically and religiously doing this?
source share