The following C# code (.NET Framework 3.5) returns name and description of all users for an AD Group "xyz". It works great as long as it returns a few number of records. But, it is very slow when it returns more than 100+ records. Any suggestions would be greately appreciated. Thank you in advance!
var context = new PrincipalContext(ContextType.Domain);
var grp = GroupPrincipal.FindByIdentity(context, "xyz");
var users = grp.GetMembers(true);
var usersList = users.Select(n => new { UserName = n.Name,
Description = n.Description })
.OrderBy(o => o.UserName.ToString());
Console.WriteLine(usersList.ToList());