Created
September 3, 2012 19:07
-
-
Save davybrion/3612472 to your computer and use it in GitHub Desktop.
code snippets for "How A Simple Foreach Statement Can Waste An Afternoon" post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void ProcessGroupsAndTheirMembers(ActiveDirectoryConfiguration adConfig) | |
| { | |
| List<GroupPrincipal> groupPrincipals = GetABunchOfGroupsFromActiveDirectory(adConfig); | |
| foreach (var groupPrincipal in groupPrincipals) | |
| { | |
| HandleGroup(groupPrincipal); | |
| DealWithMembers(groupPrincipal.Members); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void ProcessGroupsAndTheirMembers(ActiveDirectoryConfiguration adConfig) | |
| { | |
| List<GroupPrincipal> groupPrincipals = GetABunchOfGroupsFromActiveDirectory(adConfig); | |
| do | |
| { | |
| GroupPrincipal groupPrincipal = groupPrincipals[0]; | |
| HandleGroup(groupPrincipal); | |
| DealWithMembers(groupPrincipal.Members); | |
| groupPrincipals.RemoveAt(0); | |
| groupPrincipal.Dispose(); | |
| } while (groupPrincipals.Count > 0); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment