KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to create an object from an Active Directory base on a simple login. The problem is that some of the login information is valid. How could I just use a try-catch so that if an exception is thrown, just skip to the next login? Here is the code: foreach (var PharosUserItem in ListRef) { ADUser User; try { User = new ADUser(PharosUserItem.UserLoginPharos); } catch (ByTel.DirectoryServices.Exceptions.UserNotFoundException ex) { break; } } The break gets me out of the foreach , which is not what I want. Any ideas?
Tags (comma-separated)
Save Edits
Cancel