Skip to content

Instantly share code, notes, and snippets.

@colinbowern
Created May 29, 2012 00:30
Show Gist options
  • Save colinbowern/2821869 to your computer and use it in GitHub Desktop.
Save colinbowern/2821869 to your computer and use it in GitHub Desktop.
Ugly exceptions in System.DirectoryServices
try
{
directoryEntry.Children.Find(objectName, "domainDns");
}
catch (DirectoryServicesCOMException exception)
{
if (exception.ErrorCode != 0x2030)
{
throw;
}
// TODO: create object here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment